> Here is the query that I came up with to display all contents
> from yarn table.
>
> select y.*, m.mfr_desc, b.brand_desc, sw.standard_wt_desc
> from yarn y, manufacturer m, brand b, standardweighttype sw
> where y.mfr_id = m.mfr_id
> and y.brand_id = b.brand_id
> and y.standard_wt_type_id = sw.standard_wt_type_id
> order by m.mfr_desc
>
> I set up a cfloop query to output table rows for the results
> from the above query. Right now, this is how the output looks:
>
> Broad Bay | Scottish Heather | Worsted
> Brown Sheep | Handpaint Original | Worsted
> Brown Sheep | Nature Spun  Sport | Sport
> Brown Sheep | Lamb's Pride | Worsted | Worsted
> Dale of Norway | Heilo | Bulky
> Dale of Norway | Tiur | Sport
>
> What I want to do is set it up so that if I have at least two brands
> from a manufacturer, only display the manufacturer's name in the
> first row.  So that it'll look like this:
>
> Broad Bay | Scottish Heather | Worsted
> Brown Sheep | Handpaint Original | Worsted
>                      | Nature Spun  Sport | Sport
>                      | Lamb's Pride | Worsted | Worsted
> Dale of Norway | Heilo | Bulky
>                          | Tiur | Sport
>
> What are some of the methods I could use to accomplish this?

The easiest way to show a hierarchical relationship in your data is to use
the GROUP attribute of CFOUTPUT:

<cfoutput query="qWhatever" group="mfr_desc">
#mfr_desc#
<cfoutput>
#brand_desc#
</cfoutput>
</cfoutput>

I've omitted the necessary HTML formatting in the above example - you'll
have to figure out exactly what you want to do for that.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to