I would like to know how to use multiple order columnes with case. For example case 1, order by FirstName, GivenName case 2 order by GivenName, FirstName.
I tried this, but it looks like the colon introduce an error
Order by case
when 1 then FirstName, GivenName
else GivenName, FirstName end
Best Answer
Case is supposed to return one value, not a tuple. Beside, you should compare 1 with something. If you want conditional ordering you can do that with two case statements: