How to specify the Sort order for a Query in SQL Server ?


This content was proof-read by Grammarly. You can Try Grammary for FREE

If you want the sort the records in descending order by more than one column instead of the default ascending order , you can use the DESC or DESCENDING to this.

How to specify the Sort order for a Query in SQL Server ?

Here’s the query which retrieves the Department records in Descending order by two columns – Name and GroupName.

Use AdventureWorks2014
GO
SELECT * from HumanResources.Department
ORDER BY Name DESC,
GroupName DESC
How to specify the Sort order for a Query in SQL Server ?
%d bloggers like this: