Date descending and time ascending sorting in a SQL query
351481Mar 20 2003 — edited Mar 21 2003Hi,
I am using Oracle 8i. I need to perform sorting on a date field. The requirement is data should be first sorted as DATE ASC, then TIME DESC; here date and time both come from same field. For the purpose I am using following query:
SELECT date_submitted FROM <table_name>
ORDER BY date_submitted DESC, TO_CHAR(date_submitted,'HH:MI AM') ASC;
But this query is not giving me proper resultset. Sorting on time part is not correct.
Could anyone help me on this?
Thanks in advance.
Regards,
Dushyant