count() and grouping
| From: | tux | Date: | Wed, 07 Aug 2002 12:21:57 +0000 |
| Subject: | count() and grouping | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-21023@lists.php.net to get a copy of this message | ||
Hey guys, i have been trying to figure out how to do this but havent
found anything positive, anyway here is the db query that im doing:
SELECT submitted_by, COUNT(*) FROM articles GROUP BY submitted_by;
now what this returns is something like
submitted_by | count(*)
=======================
andrew 12
ben 13
terry 30
however what i want it to do is display by the highest number first ie
terry, ben, andrew, not show them in alphabetical order, this is so i
can display a 'most submissions' type thing. ive tried using ORDER by
count(*) desc and stuff like that but none of it seems to work??
any ideas greatly appreciated
jo