If you convert your date without the time in datetime
format, sql will take it and put 00:00:00 as the time
everywhere. That will make grouping function and the sort
as well.

Select DateOfLoggin=convert(datetime,dateofloggin,104),
count(UserName)
from mytable
group by convert(datetime,dateofloggin,104)

Let me know if it worked
>-----Original Message-----
>How to efficient group and sort such a table ?
>
>Fields
>
>1. DateOfLoggin as datetime (contains date and time)
>2. User name
>
>I would like to get as a result of stored procedure list
>containing number of users logged on by date (only date
>without time) and sortet by that date. I have used CONVERT
>(varchar, DateOfLoggin, 104) by then I can't sort
properly.
>Any suggestions?
>
>Thanks!
>Przemo
>.
>