**UPDATES**:

This is a tool that allow you to run full SQL queries over the merit data and is based on

SQLite. If you are familiar with SQL you know the possibilities are basically endless or limited to your SQL knowledge.

My previous similar tool (

here) is perhaps more user friendly, but has some limitation: speed and research flexibility. So this is why i made this.

You can find more information about SQL syntax in

here if you are interested to learn, i may also give a hand if somebody want to get out some particular information out, even though my SQL skills are a bit rusty.

**Table structure:**MeritData(

"Date" TEXT,

"Merit" Integer,

"Msg" TEXT,

"FromID" Integer,

"ToID" Integer,

"Board" TEXT,

"SubBoard" TEXT,

"TitleThread" TEXT

)

UserData(

UserId Integer PRIMARY KEY,

UserName TEXT,

Rank TEXT,

Trust TEXT,

Location TEXT

)

**How to use it:** Just type the query in the box and press Exceute, F5 or Ctrl-Enter to execute it.

**Link:**https://albertoit.github.io/Merit-Explorer-SQL/For those of you who are not familiar with SQL, beside the fact that you will get any result extremely fast, this is what it means:[/b]

We can easily get the Top Receiver for any local section simply using this:

SELECT MAX(result.total) as "Total Merit", result.toid as "Top merit receiver", result.SubBoard as "Local board" FROM (

SELECT toid, SubBoard, SUM(Merit) AS total

FROM meritdata as m

WHERE m.Board in (SELECT Board FROM meritdata Where Board like "Local%" GROUP BY Board)

GROUP BY toid, Board

ORDER BY Board,total Desc) AS result

GROUP BY SubBoard

ORDER BY result.total Desc

or for any board:

SELECT MAX(result.total) as "Total Merit", result.toID as "Top merit receiver", result.SubBoard as "Board" FROM (

SELECT toid, SubBoard, SUM(Merit) AS total

FROM meritdata as m

WHERE m.SubBoard in (SELECT SubBoard FROM meritdata GROUP BY SubBoard)

GROUP BY toid, SubBoard

ORDER BY SubBoard,total Desc) AS result

GROUP BY SubBoard

ORDER BY result.total Desc;

Similarly we can find out the Top Giver:

SELECT MAX(result.total) as "Total Merit", result.fromid as "Top merit giver", result.SubBoard as "Local board" FROM (

SELECT fromid, SubBoard, SUM(Merit) AS total

FROM meritdata as m

WHERE m.Board in (SELECT Board FROM meritdata Where Board like "Local%" GROUP BY Board)

GROUP BY fromid, Board

ORDER BY Board,total Desc) AS result

GROUP BY SubBoard

ORDER BY result.total Desc;

or for any any board:

SELECT MAX(result.total) as "Total Merit", result.fromID as "Top merit giver", result.SubBoard as "Board" FROM (

SELECT fromid, SubBoard, SUM(Merit) AS total

FROM meritdata as m

WHERE m.SubBoard in (SELECT SubBoard FROM meritdata GROUP BY SubBoard)

GROUP BY fromID, SubBoard

ORDER BY SubBoard,total Desc) AS result

GROUP BY SubBoard

ORDER BY result.total Desc;

Find out the total merit awarded so far:

SELECT Sum(Merit) FROM MeritData;

Want the full history for a particular user?

SELECT * FROM MeritData WHERE toID=35 OR fromID=35 ORDER BY fromid,toid;