SELECT with WHERE and ORDER BY
By: Jeremy Kadlec
Let's bring the WHERE and ORDER BY concepts together in this tutorial.
In the example below we are selecting the LoginID column from the HumanResources.Employee table where the VacationHours column equals 8 and we are ordering the data by the HireDate in ascending order which is implied.
USE AdventureWorks; GO SELECT LoginID FROM HumanResources.Employee WHERE VacationHours = 8 ORDER BY HireDate; GO
Below is the sample result set: