I have this table called logs that logs a who input or output data.
Now I wan’t to get the statistics of who has the most contributions and rank them.
Columns are
Occur_Time | iUser_id | iUsername | oUser_id | oUsername
--iUser_id is the input persons index from another table that lists the username.
--iUsername is the input persons name.
--oUser_id is the index of the person who took the input away.
--oUsername is the name of the person who took the input away.
Now I wan’t to know who has the most input.
My logic:
Example:
User_id is 1, name is One.
Check how many times 1 is repeated on iUser_id = 100 times.
Check how many times 1 is repeated on oUser_id = 10 times.
User_id=1 has contributed 90 times.
Then sort by who has most contribution.
Thank you.
(untested):