SQL system for Full Merit History
Made by Piggy
You can learn more about how to build your SQL queries in
here
and about Javascript in
here
.
SQL
Script
Enter some SQL
Execute SQL
Enter some script code
// Variable holding the sum of unspent merits for each user. var total_unspent_merits=0; // List of username and total merit received for every user. var merit_received = RunSQLSynch('SELECT username, coalesce(tot,0) From userdata Left join (select toid, sum(merit) as tot from meritdata group by toid) on userid = toid;'); // List of username and total merit given for every user. var merit_given = RunSQLSynch('SELECT username, coalesce(tot,0) From userdata Left join (select fromid, sum(merit) as tot from meritdata group by fromid) on userid = fromid;'); // We go through the lists (they have the same lenght and already ordered in the same way). for (var i=0;i
0) total_unspent_merits += user_unspent_merits; } } // Clear the output information and write the result. Clear(); WriteLine("\nTOTAL MERIT UNSPENT:" + total_unspent_merits + "\n");
Execute Script
Results will be displayed here