i want to search the table called comments, and i want to count the number of times 
artid appears. then i want to group them all together, but then i want to order them 
by most appearances to fewest. so if artid 1 appeared 40 times and it was the most, i 
want that to be retrieved first. if artid 3 appeared 38 times and it was second most, 
i want that retrieved second... etc and so on. this code ive given is wrong, but i 
know that it has to be something like this or that im close. if any of you could help 
me id really appreciate it. if theres a shortcut with this code that would be great, 
otherwise i have to run my php around in a ton of different mysql queries trying to 
find out which has the most and have it ordered from highest to lowest. thank you for 
your help. ive tried mysql.com too and i cant find a thing there. plus the mailing 
lists for mysql, no one ever responds! thank you php list, you are my only hope. ;P
-james



$mostcomquery = "SELECT artid, COUNT(*) FROM comments GROUP BY artid ORDER BY 
(COUNT(*)) DESC LIMIT 5";

Reply via email to