Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

t-sql conditional order by multiple columns

SELECT * FROM dbo.Employee
ORDER BY 
 CASE WHEN Gender='Male' THEN EmployeeName END Desc,
 CASE WHEN Gender='Female' THEN Country END ASC
 
PREVIOUS NEXT
Tagged: #conditional #order #multiple #columns
ADD COMMENT
Topic
Name
8+9 =