I have an application that creates appointments and it stores a date and a time for each appointment. When I do a search I can sort the result set by date, but I can't think of a simple way to do a sort by date and time within each date... is there some advanced SQL I can do here? For example, if I have the following appointments entered into the database in this order:
(ID, date, time):
1, 2005-01-02, 08:00:00
2, 2005-01-01, 08:00:00
3, 2005-01-01, 07:00:00
and I run this query: select * from appointments order by date asc, I get this:
2, 2005-01-01, 08:00:00
3, 2005-01-01, 07:00:00
1, 2005-01-02, 08:00:00
But I need a query that will return a result set like this:
3, 2005-01-01, 07:00:00
2, 2005-01-01, 08:00:00
1, 2005-01-02, 08:00:00
Does anyone know a way to do this? order by time, within each date? Or in other words, order by one column, but when multiple entries in a column are identicle, order those entries by another column?
Thanks in advance!