Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Date descending and time ascending sorting in a SQL query

351481Mar 20 2003 — edited Mar 21 2003
Hi,
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 18 2003
Added on Mar 20 2003
4 comments
4,565 views