[thelist] SQL: Order By Count

Rob Smith rob.smith at THERMON.com
Mon Feb 17 11:02:00 CST 2003


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

this should work.

This is actully one of my working versions (in ASP)
<copy>
select " & SearchWay & ", count(" & SearchWay & ") [num] from Searches Where
SearchSuccess = '" & SearchPref & "' group by " & SearchWay & " order by
[num] desc"
</paste>

HTH!
Rob.Smith

...
<snip>
 Is what I want possible in a
single query?
</snip>



More information about the thelist mailing list