Thiyagalingam Prashanth

Monday, October 29, 2007

Oracle's order by

When writing SQL for Oracle db, I discovered that when you are doing a 'order by' with more columns you have to specify the 'asc/desc' for every column seperately. So if you do something like this:
order by column1, column2 desc only column1 will be sorted in descending order.

You have to write the SQL like this:
order by column1 desc, column2 desc

I thought this would be a good tip to share

Labels: , , ,

0 Comments:

Post a Comment

<< Home