Page 1 of 1

Top Listing

Posted: Tue Oct 28, 2003 8:38 am
by Etherguy
This really...really pains me to write this, only because I know I have done it before many...many times.. but for the life of me I am blanking on this.

I need to make sort of a top downloader list. All the data is in a MYSQL table called xfer_stats. In this table there are a ton of columns but the ones I am interested in are usr,bytes I want to add up all the bytes per user and display. Listing all the users in order of most to least. Something similar might be done with money values in a similar application.

How do I go about doing this??

Posted: Tue Oct 28, 2003 9:08 am
by scorphus

Code: Select all

Select usr, sum(bytes) as sumBytes from xfer_stats group by usr order by sumBytes desc;

Posted: Tue Oct 28, 2003 12:37 pm
by Etherguy
Thanks. In my blind stupidity I forgot about the built in ability of MYSQL.

Thanks Again.