[thelist] SQL: Order By Count
Tab Alleman
Tab.Alleman at MetroGuide.com
Mon Feb 17 10:52:01 CST 2003
I've got a sql query:
SELECT COUNT(*), Month(TimeStamp), DayOfMonth(TimeStamp), Destination
FROM Logger WHERE (TimeStamp BETWEEN '20030213000000' AND
'20030218000000') GROUP BY Month(TimeStamp), DayOfMonth(TimeStamp),
Destination
Which gives me output like this:
Date: Destination: Count:
2/13 A 2
2/13 B 13
2/13 E 42
2/13 C 1
I want it to give me the output in order of highest Count to lowest. I
tried putting "ORDER BY Count(*)" both before and after the GROUP BY
clause, but both gave syntax errors. Is what I want possible in a
single query? The database is MySQL 3.xx, so sub-queries aren't
allowed.
Tab
More information about the thelist
mailing list