Date decending and time ascending sorting in a SQL query.
Posted on 2003-03-20
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.