ColdFusion CFScript Query of Queries Example

This post is more for me than anything else...but I couldn't find a decent example of how to write a query of queries in ColdFusion's CFScript syntax. Below you'll see two queries; the first one is a simple query using ColdFusion's auto-generated dsn, the second one narrows the result set just a bit.

    // Basic Query Syntax
    q1 = new Query();
    q1.setSQL('select * from artists');
    rs1 = q1.execute().getResult();
    // Query of Queries
    q2 = new Query();
    q2.setAttributes(rs=rs1); // needed for QoQ
    q2.addParam(name='state', value='CO', cfsqltype='cf_sql_varchar');
    q2.setSQL('SELECT * FROM rs where state = :state');
    q2.setMaxRows(2); // limit max rows, if desired
    rs2 = q2.execute().getResult();

This should produce something similar to the following output:

Hope this helps...cheers!

I always forget how to do this. Thanks for the reminder!
# Posted By existdissolve | 11/9/12 9:27 AM
Sweet. Thanks!
# Posted By BeekerMD03 | 7/9/15 2:54 PM
ColdFusion CFScript Query of Queries Example which detail you like to mentioned in this article. Such queries are very unique and very result oriented. However, I try to find some more reviews of and this will be sound good for us. Thanks for it.
# Posted By Chunen | 11/11/17 5:42 PM
A valid and detailed information about coldFusion CFscript query of queries Example have this article for us. We should follow the approach like which is very user friendly and easy to understand what is the actual topic of discussion.
# Posted By sumeerkumar | 11/27/17 7:38 PM
It is worth mentioning that rolex replica watches the redesigned middle case has become thinner, and with a flat blue crystal mirror, unlike the other models of the round mirror mirror, so that the watch does not look uk replica watches sharp from the side, even more harmonious.
# Posted By watch | 3/22/18 9:52 PM
Very nicely you described here two queries, a simple query using ColdFusion's auto-generated dsn, and the second one narrows the result set just a bit. This result oriented query are very helpful for IT students and developer of Personal Statement Folks -, which is result-driven personal statement writing help providers in UK, so students can get admission in their dream college or university. Given queries are user friendly and very easy to understand and I am sure students must be appreciate you for sharing this ColdFusion CFScript Query of Queries Example.
# Posted By Caroline | 4/10/18 3:31 AM
However you don’t found decent example still it is really understandable example of writing of how to write a query of queries in ColdFusion's CFScript syntax for developers as well as amateurs. ColdFusion platform users who are getting career advice and CV writing help from the CV Folks – should definitely find it helpful and recommend to others.
# Posted By Lauren | 4/11/18 1:05 AM
IWC's "Little Prince" series has always been a very popular watch series. Its highly recognized and very attractive blue dial and the story of the "Little Prince" have made this watch a highly watchful companion favorite.
# Posted By dsv | 5/14/18 9:18 PM

© 2018, Stephen J. Withington, Jr.  |  BlogCFC was created by Raymond Camden – Version 5.9.004

Creative Commons License  |  This work is licensed under a Creative Commons Attribution 3.0 Unported License.  |  Hosted by