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!

Sort each column individually

720806Sep 3 2009 — edited Sep 6 2009
Hi,

Need to orderby two separate columns in ascending.

Actually am populating values to an excel sheet from oracle which requires two specific columns to be sorted individually.

select * from abc
order by col1, col2;

Actually the output of the above query will be

col1 col2
1 5
2 6
3 1
4 2

but I want as shown below.

col1 col2
1 1
2 2
3 5
4 6

I need to bring in Oracle the similar feature we have in excel under 'Data' -> 'Sort' -> col1 then by -> col2.

Could anybody suggest me the best way .. Appreciate your response

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 4 2009
Added on Sep 3 2009
8 comments
951 views