Filtering Data

Use the SQL WHERE clause with a SQL SELECT statement to compare a value against a character string field. When the WHERE clause is processed, it filters the query data based on the results of the comparison.

Usage example

For example, to return employee data for only employees with the last name of Allaire, you would build a query that looks like this:

<CFQUERY NAME="GetEmployees" DATASOURCE="HRApp">  
    SELECT FirstName, LastName,
    StartDate, Salary, Contract
    FROM    Employees
    WHERE  LastName = 'Allaire'
</CFQUERY>
Note Note:The purpose of this guide is to get you up and running with ColdFusion Express. Allaire suggests that you purchase a book on SQL to learn how to use it efficiently.