SELECT with WHERE and ORDER BY

Overview

Let’s bring the WHERE and ORDER BY concepts together in this tutorial.

Explanation

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:

ngleColumnSelectStatement

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *