Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Sorting results by date
I have a table which records when a user logs into the application
table applogin
username varchar2(30),
logintime date,
etc.
I need to create a report which is grouped by day, and counts the number of times a user logs in each day.
select username, to_char(logintime,'MON-DD-YYYY'), count(*)
from applogin
group by username, to_char(logintime,'MON-DD-YYYY')
order by to_char(logintime,'MON-DD-YYYY')
This does the trick, but not in the right order. I need to sort the results by login date, by day. This query will sort the results by char order not date order i.e. Jan 1 , Jan 2 etc..
Any sugestions ???
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Thu Aug 24 2000 - 19:45:53 CDT