User Guide

Table Of Contents
Query of Queries user guide 497
action="list"
directory="#dir#"
filter="*.gif">
<!--- Retrieve all JPGs --->
<cfdirectory name="GetJPG"
action="list"
directory="#dir#"
filter="*.jpg">
<!--- Join the queries with a UNION in a QoQ (cfdirectory
automatically returns the directory name as "Name") --->
<cfquery dbtype="query" name="GetBoth">
SELECT * FROM GetGIF
UNION
SELECT * FROM GetJPG
ORDER BY Name
</cfquery>
<!--- Display output in a linked, ordered list --->
<cfoutput>
<p>The <strong>#dir#</strong> directory contains #GetBoth.RecordCount#
images:<br>
<ol>
<cfloop query="GetBoth">
<li><a href="../images/#Name#">#GetBoth.Name#</a><br>
</cfloop>
</ol>
</cfoutput>
</body>
</html>
2.
Save the page as qoq_cfdirectory.cfm in the myapps directory under the web_root.
3.
Display qoq_cfdirectory.cfm in your browser
Query of Queries user guide
The following sections discuss Query of Queries functionality. If you know SQL or have
interacted with databases, you might be familiar with some of these features.
Using dot notation
ColdFusion supports using dot notation in table names.
Example
If a structure named A contains a field named B, which contains a table named Products, you can
refer to the table with dot notation, as follows:
SELECT tape_ID, length
FROM A.B.Products;