Check out inner joins and the CFOUTPUT GROUP= parameter.

Basically, you can write one query that retrieves all the data, then output
it using nested CFOUTPUTs with the GROUP= parameter.  Here's an example that
has nothing to do with anything, is full of syntax/logic errors, and is
intended only to illustrate the concept :-)

<cfoutput group="category_id" query="mystuff">
<h3>#category_name#</h3>

        <cfoutput group="subcategory_id">
        <h4>#subcategory_name#</h4>

                <cfoutput group="subsubcategory_id">
                <h5>#subsubcategory_name#</h5>

                        <cfoutput>
                        #product_name#
                        </cfoutput>
                </cfoutput>
        </cfoutput>
</cfoutput>

This would result in something like

> category1
>    subcategory
>       subsubcategories
>         product
>       subsubcategories
>         product
>       subsubcategories
>         product
>    subcategory
> category2
>    subcategory
>       subsubcategories
>         product
>       subsubcategories
>         product
>       subsubcategories
>         product
>    subcategory
> category3
>    subcategory
>       subsubcategories
>         product
>       subsubcategories
>         product
>       subsubcategories
>         product
>    subcategory



> -----Original Message-----
> From: Art Broussard [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 10, 2000 10:52 AM
> To: [EMAIL PROTECTED]
> Subject: Need help reducing the number of queries
>
>
> I need to query my table to find all my categories.
>
> I output that category name and then query to find all of its
> subcategories.
>
> I output that subcategory name and then query to find all of its
> subsubcategories.
>
> I output that and then query to find all my products that are in that
> subsubcategory.
>
> I then keep going back up a level until all the cats subcats and
> subsubcats
> with products have been listed.
>
> If I have 8 categories and each category has at least 3 subcategories and
> each subcategory has at%20least 3 subsubcategories and all
> subsubcategories
> have products in them I end up with a very long time to wait for the page.
>
> Is there ANY way to do this faster with out doing a verity search
> ????!!!!
> It's killing me.
>
> The output ends up like this visual aid:)
>
> category
>    subcategory
>       subsubcategories
>         product
>       subsubcategories
>         product
>       subsubcategories
>         product
>    subcategory
>       subsubcategories
>         product
>       subsubcategories
>         product
>       subsubcategories
>         product
>    subcategory
>       subsubcategories
>         product
>       subsubcategories
>         product
>       subsubcategories
>         product
> category
>    subcategory
>       subsubcategories
>       ........
>
> Thanks
>
> Art
>
>
>
>
>
>
>
>
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>
> ------------------------------------------------------------------
> ------------
> Archives: http://www.eGroups.com/list/cf-talk
> 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.eGroups.com/list/cf-talk
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