[thelist] SQL: Order By Count

Tab Alleman Tab.Alleman at MetroGuide.com
Mon Feb 17 12:06:03 CST 2003


Rob Smith wrote:
> Yah Tab, try this:
>
> SELECT COUNT(*) as QueryCount, Month(TimeStamp),
> DayOfMonth(TimeStamp), Destination FROM Logger WHERE (TimeStamp
> BETWEEN '20030213000000' AND '20030218000000') GROUP BY
> Month(TimeStamp), DayOfMonth(TimeStamp), Destination Order by
> QueryCount

Ok, I did and it works but The Thing is that the Order By QueryCount
overrides the Group ordering, so to really get what I wanted I actually
had to add:  ORDER BY Month(TimeStamp), DayOfMonth(TimeStamp),
QueryCount

..and now it's beautiful.  Thanks!
T



More information about the thelist mailing list