Export (0) Print
Expand All
1 out of 1 rated this helpful - Rate this topic

Choosing Specific Columns

To select specific columns in a table, explicitly list each column in the select list. For example, to list only the first names of people in the Persons.Person table and their telephone numbers, use:

SELECT p.FirstName, pp.PhoneNumber
FROM AdventureWorks2008R2.Person.Person AS p
JOIN AdventureWorks2008R2.Person.PersonPhone AS pp
     ON p.BusinessEntityID = pp.BusinessEntityID
ORDER BY FirstName ASC;

Specifying the columns in the select list can also include specifying an alias (for example, proj_sales AS "Projected Sales") or other expressions, such as (price = price * 1.15, or SUM(SalesAmount).

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.