decode in order by - asc/desc
416760Mar 15 2004 — edited Mar 24 2004I'm trying to be able to dynamically change the asc/desc in the order by.
Here is some sql that works:
select * from transactions order by decode(somevar,'a',acct_nbr,'c',card_number,acct_nbr) asc
What I wanted was something like this:
select * from transactions order by decode(somevar,'a',acct_nbr,'c',card_number,acct_nbr) decode(anothervar,'a',asc,'d',desc,asc)
but this doesn't appear to work. Am I missing something, or is there another way.
Thanks in advance,