Click to See Complete Forum and Search --> : [RESOLVED] ORDER BY question ...


Avihai
01-22-2008, 07:59 PM
Hi all,

I have this code:

SELECT name, COUNT(userid) AS most FROM table WHERE published=1 GROUP BY userid


and I want to ORDER BY the result of most after being counted, any ideas?

Thanks,
Avihai

chazzy
01-22-2008, 10:18 PM
did you try just putting the order by clause on it?


SELECT name, COUNT(userid) AS most FROM table WHERE published=1 GROUP BY userid ORDER BY most;

Avihai
01-23-2008, 02:54 AM
Very interesting ... I did it before I posted and it didn't work, but after it did. Anyhow thanks for taking the time to answer :-)