Filtering on Multiple Columns

The WHERE clause also can take multiple conditions. To search for Ben Forta, for example, you can specify a search condition in which the first name is Ben and the last name is Forta, as shown in Listing 6.8. As Figure 6.11 shows, only Ben Forta is retrieved.

Figure 6.11. You can narrow your search with multiple WHERE clauses.
Listing 6.8. SELECT with Multiple WHERE Clauses
SELECT FirstName, LastName, Email
FROM Contacts
WHERE FirstName='Ben' AND LastName='Forta'

Caution

Text passed to a SQL query must be enclosed within quotation marks. If you omit the quotation marks, the SQL parser thinks ...

Get Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.