Results of a SELECT statement

When the database processes a SELECT statement, it returns a record set containing the requested data. The format of a record set is a table with rows and columns. For example, if you write the following query:

SELECT * FROM employees WHERE DeptID=3

The query returns the following table:


Results from the SELECT query

Since the data returned to ColdFusion MX by a SELECT statement is in the form of a database table, ColdFusion MX lets you write a SQL query on the returned results. This functionality is called query of queries. For more information on query of queries, see Accessing and Retrieving Data.

The next example uses a SELECT statement to return only a specific set of columns from a table:

SELECT LastName, FirstName FROM employees WHERE DeptID=3

The query returns the following table:


Results of a SELECT query returning selected table columns


View comments in LiveDocs