Filtering Data Based on Multiple Conditions

Combine a SQL WHERE clause with a SQL AND clause in your queries when you only want to retrieve data based on the results of more than one comparison.

Usage example

For example, to return data for contract employees who earn more than $50,000, you would build a query that looks like this:

<CFQUERY NAME="GetEmployees" DATASOURCE="HRApp"> 
    SELECT FirstName, LastName
    StartDate, Salary, Contract
    FROM    Employees
    WHERE   Contract = 'Yes'
    AND     Salary > 50000 
</CFQUERY>