ordering dates in Oracle

50 pts.
Tags:
Oracle
Oracle Database
Oracle Forms
Oracle Table
how to order the months and year in descending order from a table?suppose there are 2 culomns one contains month and another contains year.then how to show them in an order like jan-2001,feb-2001,mar-2001.........like this.

plz suggest some answer for this.



Software/Hardware used:
oracle
ASKED: August 9, 2010  3:49 AM
UPDATED: August 9, 2010  2:05 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

Here’s an option:

<pre>SELECT * FROM your_table
ORDER BY TO_DATE(’01′||month||year,’DDMONYYYY’);</pre>

If you really want them in descending order (your example shows them in ascending order) just add the DESC keyword at the end of the query.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following