SQL Server Home @ it-notebook.org

How to...retrieve data based on one condition

(Kristofer Gafvert, October 11, 2009)

Usually when you want to see data from a table, you do not want all data, but instead data that satisfy a criteria. The following example retrieves addresses from the Person.Address table in the AdventureWorks sample database, where the city is "Bothell".

SELECT *
FROM Person.Address WHERE City = 'Bothell'

Remember that text must be enclosed with apostrophes (� character).

In the above example, the WHERE clause is used to restrict rows returned by the query.

Applies to [?]

SQL Server 2008

See also