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.

<cfscript>
    // Basic Query Syntax
    q1 = new Query();
    q1.setDatasource('cfartgallery');
    q1.setSQL('select * from artists');
    rs1 = q1.execute().getResult();
    WriteDump(var=rs1,label='RS1');
    
    // Query of Queries
    q2 = new Query();
    q2.setDBType('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();
    WriteDump(var=rs2,label='RS2');
</cfscript>

This should produce something similar to the following output:

Hope this helps...cheers!

Comments
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 http://best-essay-writing-service.reviews/ 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 https://appuals.com/how-to-fix-high-cpu-usage-by-s... 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 http://www.rolexreplicasstore.uk.com 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 http://www.swisswatchjust.co.uk 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 - http://www.personalstatementfolks.co.uk/, 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 – https://www.cvfolks.co.uk should definitely find it helpful and recommend to others.
# Posted By Lauren | 4/11/18 1:05 AM
IWC's "Little Prince" series has http://www.bestukwatches.co.uk always been a very http://www.rolexsreplicas.org.uk popular watch series. Its highly recognized and very attractive blue dial and the http://www.toprolexreplicauk.co.uk story of the "Little Prince" have made this watch a highly watchful http://www.perfectreplicawatch.me.uk companion favorite.
# Posted By dsv | 5/14/18 9:18 PM
I am really glad to read it and being able to share my thoughts on it. I want to use this opportunity <a href="https://www.fbvideo.me/"; title="facebook video">facebook video</a>
to say that I really love this blog. It is an amazing resource of information for my working. Thank you so much.
# Posted By facebook video | 8/29/18 3:44 AM
Wig female, pear https://www.wigsandclips.co.uk flower head, air Qi Liu Hai, inside the http://www.humanhair-extensions.co.uk middle point, fashion and natural, realistic https://www.humanhairwig.org.uk micro-volume, wig set,https://www.hair-extensions2go.co.uk head black, Korean side, new specials.
# Posted By hair extensions sale | 8/30/18 2:48 AM
Thanx for sharing such useful post keep it up :)
# Posted By Accounting Managerial Writing Service | 9/28/18 1:51 AM
I’m really impressed with your article, such great & usefull knowledge you mentioned here
# Posted By Accounting Managerial Writing Service | 9/28/18 5:55 AM
I’m really impressed with your article, such great & usefull knowledge you mentioned here
# Posted By Accounting Managerial Writing Service | 9/28/18 6:02 AM
http://percentagecalculator.wiki/
Je vous remercie de l'information! Je cherchais et ne pouvait pas trouver. Vous me aidé!
# Posted By percent calculator | 10/2/18 2:15 AM
This content is very informative for me. Thank you so much for sharing. Need Allassignmenthelp? Allassignmenthelp Provide best all Assignment Help to the student at cheapest cost.
# Posted By Assignment Help | 12/29/18 3:23 AM
In today’s time students face the problem of stress in college. Whether it is because of social anxiety, or not being able to clear exam etc. Most of the times, students get stressed due to their piled up assignments. If it is with you also then you might look for Allassignmenthelp.co.uk Reviews .
# Posted By Assignment Help | 12/29/18 5:31 AM
I’m really impressed with your article, such great & usefull knowledge you mentioned here. Thank you for sharing. https://www.igstories.net/
# Posted By instagram viewer | 1/2/19 9:38 PM

© 2019, 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 Hostek.com