CASE Expression for Order By Clause with Multiple Columns and Desc/Asc Sort
Following on from my earlier question here Case expression for Order By clause with Desc/Asc sort I have a statement like this:
SELECT
*
FROM
TableName
WHERE
ORDER BY
CASE @OrderByColumn WHEN 1 THEN Forename END DESC,
CASE @OrderByColumn WHEN 2 THEN Surname END ASC
This works well, but sometimes I need more than column in the order by. I actually need something like this:
.....
ORDER BY
CASE @OrderByColumn WHEN 1 THEN Forename, Date, Location END DESC
I can't work out how to make the CASE expression allow multiple columns in the THEN part.