[thelist] cfoutput query

Rudy_Limeback at maritimelife.ca Rudy_Limeback at maritimelife.ca
Fri Nov 24 13:01:40 CST 2000


> Does ANYBODY know a way of performing the equivalent of a 
> "nested query output".  Possibly I can illustrate ...

hi ed

yes, you'll want a join query as chris pointed out

<tip>
be careful using a table name like "client" as it may lead to confusion 
with cold fusion client variables when you qualify a table column. e.g. 
client.checkvalue
</tip>

here's your query, assuming multiple otherTable records per clientTable 
record

     SELECT clientTable.id as clientid, clientTable.stuff
          , otherTable.id as otherid, otherTable.stuff
       FROM clientTable
     INNER JOIN otherTable 
         ON clientTable.id = otherTable.clientid

but your original question asked about "nested query output" and this 
usually refers to output that is structured into groups of data, as in

    client 1 
       other a
       other b
       other c
    client 2 
       other p
       other q

in cold fusion, use nested cfoutput tags and the GROUP= attribute

 <cfoutput query=theJoin group=clientid>
    client #clienti# 
     <cfoutput>
      other #otherid"
     </cfoutput>
 </cfoutput>

ed, i just re-read your question, and it's entirely possible i got the 
cardinality of the relationship backwards, perhaps you have multiple 
clients per other record -- in that case, just switch all the above names 
around  ;o)


rudy
r937.com




More information about the thelist mailing list