A user reported this to me earlier in the week. I was sure he was wrong until I confirmed it myself. Imagine you have 2 queries you want to join using a query of query. Here is a quick sample.
2 select id, title,posted
3 from tblblogentries
4 order by posted desc
5 </cfquery>
6 <cfquery name="q2" datasource="blogdev" maxrows="5">
7 select id, title,posted
8 from tblblogentries
9 order by posted asc
10 </cfquery>
Admittedly, this is kind of a dumb example, but I wanted to keep it simple. q is a query sorted by posted, descending, and q2 is the reverse of that. To join with query of queries, you must use a where clause, you can't use join. Here is the QofQ I used:
Note that I gave the new query the name z. Everything should be kosher, right? Well watch what happens when I dump q before and after the query of query.

What the heck, right? The error goes away if you make a duplicate of q and use that in the query of query.
Comment 1 written by Josh Curtiss on 2 July 2009, at 3:52 PM
Comment 2 written by Mischa on 2 July 2009, at 4:13 PM
Comment 3 written by Mischa on 2 July 2009, at 4:14 PM
Comment 4 written by Robert Gatti on 2 July 2009, at 4:15 PM
Comment 5 written by Raymond Camden on 2 July 2009, at 4:18 PM
Comment 6 written by goldCoastNerd on 2 July 2009, at 8:15 PM
Comment 7 written by DRew on 2 July 2009, at 9:12 PM
Comment 8 written by Joshua Curtiss on 2 July 2009, at 10:18 PM
Comment 9 written by Joshua Curtiss on 2 July 2009, at 10:19 PM
Comment 10 written by JC on 6 July 2009, at 4:40 PM
Comment 11 written by Andy Sandefer on 7 July 2009, at 11:38 AM
Comment 12 written by Albert on 5 August 2009, at 8:40 AM
I am trying to use string functions in QofQ like LEFT(string, count), or RIGHT(string, count) and I have:
" Query Of Queries syntax error.
Encountered "Left. Incorrect Select List, Incorrect select column".
For first query I am using a :
<cfdirectory directory="#application.installPath##application.PDFfilesDir#" name="memberList" action="LIST" sort = "directory ASC">
Then,
<cfquery dbtype="query" name="reportsQuery">
SELECT distinct Name, Left(Name, 12) AS PDF
FROM memberList
</cfquery>
I need to show only first 12 charachters in the <cfselect>
Comment 13 written by Raymond Camden on 5 August 2009, at 1:15 PM
[Add Comment] [Subscribe to Comments]