
428
DEVELOPING
COLDFUSION 9 APPLICATIONS
Accessing and Using Data
Las
t
upda
te
d 8/5/2010
Deleting multiple records
You can use a SQL condition to delete several records. The following example deletes the records for everyone in the
Sales department (which has Dept_ID number 4) from the Employee table:
DELETE FROM Employee WHERE Dept_ID = 4
To delete all the records from the Employee table, use the following code:
DELETE FROM Employee
Important:
Deleting records from a database is not reversible. Use DELETE statements carefully.
Using Query of Queries
A query that retrieves data from a recordset is called a
Query of Queries
. After you generate a recordset, you can interact
with its results as if they are database tables by using Query of Queries.
About recordsets
Query of Queries is based on manipulating the recordset, which you can create using the
cfquery
tag and other ways.
When you execute a database query, Adobe ColdFusion retrieves the data in a
recordset
. In addition to presenting
recordset data to the user, you can manipulate this recordset to improve the performance of your application.
Because a recordset contains rows (records) and columns (fields), you can think of it as a virtual database table, or as
a spreadsheet. For example, the
cfpop
tag retrieves a recordset in which each row is a message and each column is a
message component, such as To, From, and Subject.
Creating a recordset
You can perform a Query of Queries on any ColdFusion tag or function that generates a recordset, including the
following:
•
cfcollection
•
cfdirectory
•
cfftp
•
cfhttp
•
cfindex
•
cfldap
•
cfmail
•
cfpop
•
cfprocresult
•
cfquery
(against a database or against another Query of Queries)
•
cfsearch
•
cfstoredproc
•
cfwddx
•
The
QueryNew
function