Skip to main content
Inspiring
March 20, 2008
Question

query withing query loop

  • March 20, 2008
  • 1 reply
  • 297 views
Hi all,

This is the situation that I have
<query1>
<cfloop query1>
<query2>
<cfoutput query2>
<cfoutput query2>
</cfloop>
</cfloop>
Lets say that query2 has 2 rows, I am getting data from row1 in row2 where row2 fields are empty.
So if I have row1 query2.name = 'mike' I'll get that same value in row2 if the row2 name is blank?
This topic has been closed for replies.

1 reply

Inspiring
March 20, 2008
TiGGi wrote:
> Hi all,
>
> This is the situation that I have
> <query1>
> <cfloop query1>
> <query2>
> <cfoutput query2>
> <cfoutput query2>
> </cfloop>
> </cfloop>
> Lets say that query2 has 2 rows, I am getting data from row1 in row2 where
> row2 fields are empty.
> So if I have row1 query2.name = 'mike' I'll get that same value in row2 if the
> row2 name is blank?
>


A) Nine times out of ten when one has logic like this it can be
simplified with a single join query and a single query output loop.

B) When one does do logic like this, one almost always has to use fully
qualified query references. Otherwise ColdFusion gets confused about
what row of each query is being output and just outputs the first row.

A fully qualified query reference is #queryName.column[row]# OR
#queryName['column'][row]#