Try something like this:

<CFQUERY name="x" datasource="dsn">
SELECT field1, field2, field3
FROM myTable
ORDER BY field1, field2
</CFQUERY>

<cfoutput query="x" group="field1">
#x.field1#<br>
<cfoutput>
&nbsp; #x.field2# - #x.field3#<br>
</cfoutput>
</cfoutput>

Cfoutput will group a queries output by one of the order by field by nesting the 
cfouput tags and using the group parameter.

I think that's what you're trying to do.

Regards

Darren Tracey

> -----Original Message-----
> From: Gareth [mailto:[EMAIL PROTECTED]
> Sent: Friday, 10 October 2003 3:17 PM
> To: CFAussie Mailing List
> Subject: [cfaussie] Looping over a query.
> 
> 
> I wish to group a field in a query so that I may output each 
> group of items.
> IE in a recordset rides has MTB, MTB, MTB, ROAD ROAD ROAD. 
> But I want to
> seperate the outputs. Is the easiest way just to do a query 
> to find the
> unique items then do another couple of queries to output each group
> seperately? Or can I do loops based on conditions or something?
> 
> If you can work out what I just said and ya can help me out.. 
> that would be
> great.
> 
> Cheers
> 
> Gareth Edwards.
> 
> [EMAIL PROTECTED]
> 
> 
> 
> 
> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to 
> [EMAIL PROTECTED]
> 
> MX Downunder AsiaPac DevCon - http://mxdu.com/
> 

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to