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.

Note To create a SELECT statement:
  1. Select the first table you want to query.
  2. 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.
  3. Drag and drop column names between tables to create joins.
  4. Right-click on a join to delete the join or change it to an inner or outer join.
  5. Drag the columns you want to display onto the Column section of the Properties pane.
  6. Set additional query attributes in the Properties pane.
  7. Save or insert the query into your page.
Note To use a CFML variable in a SQL WHERE clause:
  1. In the Properties pane, click in the Criteria column for the column that you want use in the WHERE clause.
  2. Open the select box and choose the appropriate variable syntax.
  3. Double-click on the variable placeholder name and enter a value.
Note To save a query:
  1. Click the Save Query button on the Query toolbar.
  2. Enter a name for the query in the dialog.
  3. 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.