The simplest fix to your posted code is to use the cfloop tag for at least
one of the queries.  Cfloop tags can be nested.


<cfquery datasource="DSN" name="query1">
SELECT fields_various
FROM  table1
/cfquery>

<cfquery datasource="DSN" name="query2">
SELECT columns_various
FROM table2
</cfquery>

<cfquery query="query1">
#fields_various#

<cfloop query="query2">
#columns_various#
</cfloop>

</cfoutput>


Now when you start to nest queries, the automatic scoping of queries can get
confused and problematic, so it's evan more important to scope your query
variables (query1.fields_various, query2.fields_various).


Beyond this you can get into using the array notation form of queries and do
some really sophisticated mixing.

--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA

-----Original Message-----
From: Tim Laureska [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 18, 2003 12:08 PM
To: CF-Talk
Subject: nesting output from 2 queries

If you have two different queries and you want to put the output of one
of those queries within the other, is that possible, if so how (group
processing doesn't appear to be an option)?  Such as:

<cfquery datasource="DSN" name="query1">
SELECT fields_various
FROM  table1
/cfquery>

<cfquery datasource="DSN" name="query2">
SELECT columns_various
FROM table2
</cfquery>

<cfoutput query="query1">
#fields_various#

<cfoutput query="query2">
#columns_various#
</cfquery>

</cfoutput>

TIA
Tim

   _____  


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to