Or even easier, without the loop.

<cfset list_id = ValueList(qMyQuery.id)>
<cfquery dbtype="query">
     SELECT * 
     FROM qMyQuery 
     WHERE id IN (#list_id#)
</cfquery>

--
Russ
 

-----Original Message-----
From: Terry Sta. Maria [mailto:[EMAIL PROTECTED] 
Sent: 05 January 2007 20:52
To: CF-Talk
Subject: Re: Query of Queries question

You don't necessarily have to create a query from scratch.  Instead, if
there is a column (with a simple datatype) that uniquely identifies each
row, this can be done with a list and a query of queries.

If qMyQuery.id is such a column, then you can get those all into a list:

<cfset list_id = ''>
<cfloop query="qMyQuery">
     <cfif qMyQuery.currentRow gte int_rowStart and qMyQuery.currentRow lte
int_rowEnd>
          <cfset list_id = listAppend(list_id, qMyQuery.id)>
     <cfelseif qMyQuery.currentRow gt int_rowEnd>
          <cfbreak>
     </cfif>
</cfloop>

Then you can do your query of queries with this list:
<cfquery dbtype="query">
     SELECT * 
     FROM qMyQuery 
     WHERE id IN (#list_id#)
</cfquery>

If your id column isn't numeric, you can loop through the list creating
"LIKE" clauses for string, or similar comparisons for other simple data
types.


Hope this helps.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:265875
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to