[thelist] SQL: Order By Count
Joshua Olson
joshua at waetech.com
Mon Feb 17 12:59:00 CST 2003
----- Original Message -----
From: "Tab Alleman" <Tab.Alleman at MetroGuide.com>
Sent: Monday, February 17, 2003 1:08 PM
> 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
Tab,
Likewise, you could use this as your ORDER BY clause:
ORDER BY 2, 3, 1
That tells the server to order by the 2nd column, 3rd column, and then 1st
column.
I notice that you didn't alias your calculated columns except the count(*)
column. Using the technique above you could technically get away without
any aliases whatsoever--unless you need the alias in your scripting
language.
HTH,
-joshua
More information about the thelist
mailing list