ORDER BY clause
with CASE Expressions(CASE STATEMENT):
googling some code examples on how to use “ORDER BY clause with CASE
Expressions (CASE STATEMENT)”, with some googling information I tried following
t-sql code and that worked for me.
I want to share in this post with example and code sample.
Searched CASE expression:
CASE expression evaluates a set of Boolean expressions to determine the result.
In this example
searched CASE expression used to decide order, for male all records are in
descending order and for female ascending order.
SELECT * FROM dbo.Employee
CASE WHEN Gender='Male' THEN EmployeeName END Desc,
CASE WHEN Gender='Female' THEN Country END ASC