Query Output Notes and Considerations
When outputting query results, keep these guidelines in mind:
- Run a CFQUERY before referencing its results using a CFOUTPUT with a QUERY attribute.
- It's a good idea to run all queries before all output blocks.
- The QUERY attribute must refer to an existing CFQUERY NAME attribute.
- Surround variable references with pound signs to output their current values to a page.
- Prefix variables with their variable type - in the case of a query variable, it's the name of the query.
- When outputting the data itself, you define the variable name using the QUERY attribute.
- When outputting query properties variables, don't use the QUERY attribute; instead, prefix the variable reference with the name of the query.
- Columns must exist and be retrieved to the application in order to output their values.