Half asleep.  Norman's got the right answer on this one.

Sharon

At 09:52 PM 8/13/2000 -0400, Norman Elton wrote:
>From the looks of it, you're trying to get an output like:
>
>---
>City 1
>       Neighborhood A
>       Neighborhood B
>       Neighborhood C
>
>City 2
>       Neighborhood D
>       Neighborhood E
>       Neighborhood F
>---
>
>If so, try this:
>
>---
><CFQUERY Name="MyQuery">
>       select city, neighborhood
>       from areas
>       order by city, neighborhood
></CFQUERY>
>
><CFOUTPUT Query="MyQuery" Group="City">
>       #City#<BR>
>       <CFOUTPUT>
>               #Neighborhood#<BR>
>       </CFOUTPUT>
>       <BR>
></CFOUTPUT>
>---
>
>The query returns all the neighborhoods and their corresponding cities,
>sorted for a nice pretty output (this is actually important if your cities
>appear out of alphabetical order in the database).
>
>The first CFOUTPUT tells ColdFusion that you will be outputting the query,
>and you want to group the output by city. The code outside the second
>CFOUTPUT is only executed once per city. The code inside the second CFOUTPUT
>is then executed once per record (i.e. in this case, once per neighborhood).
>Once a new city is reached, this inner loop stops and the process starts
>over again with the first CFOUTPUT.
>
>Hope this helps. If this wasn't what you were trying to do, well now you
>know!
>
>Norman Elton
>Information Technology
>College of William & Mary
>
>-----Original Message-----
>From: Mark Ireland [mailto:[EMAIL PROTECTED]]
>Sent: Sunday, August 13, 2000 9:13 PM
>To: [EMAIL PROTECTED]
>Subject: Re: nesting queries
>
>
>
>Its is as easy as
>>        where city = '#cities.city#'
>
>
>
>At 09:09 PM 13/08/00 -0400, you wrote:
>>also a novice, and am stuck. Am trying to nest a query theoretically like
>>the following...
>>
>><CFQUERY name='cities'>
>>   select city
>>   from areas
>></CFQUERY>
>>
>><CFOUTPUT>#city#<br>
>>
>>    <CFQUERY>
>>        select neighborhood
>>        from areas
>>        where city = '#city#'
>>     </CFQUERY>
>>     <CFOUTPUT>#neighborhood#<br></CFOUTPUT>
>>
>></CFOUTPUT>
>>
>>I know this has got to be quite simple to do, but I'm just lost in all the
>>unfamiliar phrases and documentation. Can anyone tell me the trick?
>>
>>Cheers,
>>
>>Mark
>
>----------------------------------------------------------------------------
>--
>Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
>To Unsubscribe visit
>http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
>send a message to [EMAIL PROTECTED] with 'unsubscribe' in
>the body.
>
>---------------------------------------------------------------------------
---
>Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
>To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
> 

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to