Im doing a loop within a loop to get the distinct Category in the records for a 
business directory.  It works great if there is just one column of categories 
but I have it set up where you can add the record in three different 
categories.  

Below works with one category


<cfquery name="qBusiness_category" datasource="#request.dsn#">
SELECT DISTINCT category1
FROM dbo.#stationName#_business_dir
ORDER by category1 DESC
</cfquery>

<table width="673" border="0">
  <tr>
    <td width="105">Category</td>
    <td width="468">Name</td>
    <td width="86">&nbsp;</td>
  </tr>
  <cfloop query="qBusiness_category">

                <cfquery name="qBusiness2" datasource="#request.dsn#">
                                        SELECT id, name
                                        FROM dbo.#stationName#_business_dir
                    WHERE category1 like '#qBusiness_category.category1#'
                                </cfquery>
  
  <tr>
    <td width="105"><cfoutput>#qBusiness_category.category1#</cfoutput></td>
    <td width="468">&nbsp;</td>
    <td width="86">&nbsp;</td>
  </tr>


 <cfloop query="qBusiness2">
        
               
  <cfoutput>
  <tr  bgcolor="###iif(currentrow MOD 2,DE('f2f8fd'),DE('ffffff'))#">
    <td width="105">&nbsp;</td>
    <td width="468">#name#</td>
    <td width="86">&nbsp;</td>
  </tr>
  </cfoutput>

</cfloop>
        </cfloop>




so it outputs like so

Automotive New Cars
        Jims Car Dealership(in Category1) 
        Meep12(in Category1)

Automotive Old Cars
        Meep3(in Category1)
        Meep4(in Category1)

I want to add the two more category place 

Automotive New Cars
        Jims Car Dealership(in Category1)
        Meep12(in Category1)


Automotive Old Cars
        Jims Car Dealership(in Category2)
Meep3(in Category1)
        Meep4(in Category1)


Automotive Parts
Jims Car Dealership(in Category3)


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320188
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to