I am having the worst time right now with a Case Statement in my Order By clause. What I need to do is have my query sort by 2 columns when the client is ClientA and have it sort by a different column when it's ClientB.
I tried this:
SQL
1 2 | ORDERBY(CASEWHENcli.clientname='Client A'THENColumnA,ColumnBEND)ORDERBY(CASEWHENcli.clientname<>'Client A'THENColumnCEND) |
because a forum online suggested it... Didn't work.
So then I tried this because it made sense to me:
SQL
1 2 3 4 | ORDERBYCASEWHENcli.clientname='Client A'THENColumnA,ColumnBELSEColumnCEND |
And that also didn't work.
So do any of you possibly know how to make this work?