Order by on multiple columns in ascending and descending order in SQL Server
How to order multiple columns first on ascending then descending again in ascending and again on descending in SQL Server.
Like this
ORDER BY A ASC, then B DESC then C ASC then D DESC
Please help me order my records!!!
2 Answers
You already given your answer, just remove then and place comma
Your order by will be
ORDER BY A ASC, B DESC , C ASC, D DESC
|
2
|
Answered:
05 Mar 2013
Reputation: 252
|
|
you can also use column number to sort your records
Order By 1 Asc, 2 Desc, 3 Asc, 4 Desc
|
1
|
Answered:
05 Mar 2013
Reputation: 1,109
|
|
This week users
