Dynamically Generating SQL Statements

As you learned in Chapter 5, Building Pages that Retrieve Data, you can retrieve a record for every employee in a database table by composing a query like this:

<CFQUERY NAME="GetEmployees" DATASOURCE="HRApp">  
    SELECT  FirstName, LastName,
    StartDate, Salary, Contract
    FROM   Employees
</CFQUERY>

But when you want to return information about employees that match user search criteria , you would add the following to an action page query:

To see what we mean, sample this training snippet.