Using ColdFusion Studio
|
|
Chapter 7 : Accessing ColdFusion Data Sources
|
Building a SELECT Statement
SQL SELECT statements let you specify the data from which to build a recordset. This procedure begins with SQL Builder open.
 |
To create a SELECT statement:
|
- Select the first table you want to query.
- Right-click in the Table pane and choose Add Table or click the Add Table button in the tool bar to add additional tables to the query.
- Drag and drop column names between tables to create joins.
- Right-click on a join to delete the join or change it to an inner or outer join.
- Drag the columns you want to display onto the Column section of the Properties pane.
- Set additional query attributes in the Properties pane.
- Save or insert the query into your page.
 |
To use a CFML variable in a SQL WHERE clause:
|
- In the Properties pane, click in the Criteria column for the column that you want use in the WHERE clause.
- Open the select box and choose the appropriate variable syntax.
- Double-click on the variable placeholder name and enter a value.
 |
To save a query:
|
- Click the Save Query button on the Query toolbar.
- Enter a name for the query in the dialog.
- Click Save.
Saved queries are stored on the ColdFusion Database Server. They can be edited and used by to everyone who has access to that server.
If you edit a SQL statement in the SQL pane and then save the query, the changes are saved. However, if you modify the Table pane or change any values in the Properties pane, a new SQL statement is generated, overwriting any edits you made in the SQL pane.
Copyright © 1999, Allaire Corporation. All rights reserved.
|
|