Hi ,
I have a query as below ;
I need to fetch records order by multiple columns.
e.g.
select * from my_tab order by col1 desc ,col2 ;
But , I need to sort based on a relation between col1 , col2
e.g. say , one of the records to be fetched has col1 has value of 5 and col2 has a value of 6
another record to be fetched has col1 has value of 2 and col2 has a value of 1
Now , If I run the above query , first I will get the record( say , R1) that has col1,col2 values as 5,6 ; the record(say ,R2) that has col1,col2 values as 2,1 will come next.
But , I want R2 to come first , I want to first fetch those records which have col1>col2
Please advise how to model the query accordingly.
Thanks.