Multiple column SELECT example



By:

Overview
To expand on the previous tutorial, multiple columns can be accessed from a single SELECT statement.  In this circumstance we will select a few different columns from a table and all of the associated rows will be returned.  Let's take a look at a simple example. 

Explanation
In the example below we are selecting the EmployeeID, LoginID and HireDatecolumn columns from the HumanResources.Employee table.  Here is the sample code:

USE AdventureWorks;
GO 
SELECT EmployeeID, 
       LoginID,
       HireDate
FROM HumanResources.Employee;
GO

Below is the sample result set:


Last Update: 3/9/2009






Comments For This Article





download


get free sql tips
agree to terms


Learn more about SQL Server tools