Monday, 6 August 2007

Explain ORDER BY statement in SQL Server.

The ORDER BY clause is used to sort the output in the specified manner like ascending or descending.

Ex :
Select EmployeeName, EmployeeID from Employees order by EmployeeName Desc

This Query will display the Employee names in reverse alphabetical order.

Select EmployeeName, EmployeeID from Employees order by EmployeeName Desc, EmployeeID Asc

This Query will display the Employee names in reverse alphabetical order and the Employee ID in alphabetical order.

Labels:


Bookmark this Blog in your Favorites

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home