Well, I dug into the CF docs and figured this out (mostly). You just
nest another set of <cfoutput></cfoutput> tags within the outer looping
cfoutput. The question I have now is how can I conditionally produce
the comma separators? Is there anything I can test to tell me I'm
outputting the last item of a group (so I don't append a comma)? Here's
what I have:
<table>
<tr>
<th>Agent</th>
<th>Territories</th>
</tr>
<cfoutput query="r" group="agentid">
<tr>
<td>#r.firstname# #r.lastname#</td>
<td><cfoutput>#r.territory#,</cfoutput></td>
</tr>
</cfoutput>
</table>
Jim
-----Original Message-----
From: Jim McAtee <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Tuesday, August 29, 2000 6:17 PM
Subject: Query Help - Using 'GROUP'
>I've got a one to many relationship linking tables A -> B -> C. For
>each item in A (sales reps), I've got multiple records in B (linking
>reps to territories) and C contains the territories - say North, South,
>East and West. I want to output a table something like
>
>Reps Territories
>----- ------------
>Bill S,W
>Mike N,S,E
>Joe E,W
>
>The question is: Can I use CF's <cfoutput QUERY="myquery"
>GROUP="AgentID"> to easily create this table? If so, how do I produce
>the lists of territories? Grouping on the RepID essentially throws out
>the 2nd, 3rd, 4th etc. territory and I can only display the first one.
>If it can't be done easily in CF, can it be done in SQL (MS SQL)? My
>last resort would be to just get all the reps, loop through that query
>and do a query on B & C each time through the loop. That's what I'm
>trying to avoid.
>
>Thanks,
>Jim
>
>-----------------------------------------------------------------------
-------
>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.
------------------------------------------------------------------------------
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.