> I was trying to nest loop 2 queries.

hi mike

that is seldom a good idea  ;o)

often a join is required, but in your case, you are going back into the
same table, one category at a time!

>  <CFQUERY NAME="FIRST" ...>
>     SELECT DISTINCT Category
>       FROM RRC_members
>  </CFQUERY>
>
>  <CFLOOP QUERY="FIRST">
>     <CFQUERY NAME="SECOND" ... >
>        SELECT *
>          FROM RRC_members
>         WHERE category= '#FIRST.Category#'
>     </CFQUERY>
>     <CFOUTPUT QUERY="SECOND">
>          #SECOND.member_id#<br>
>     </CFOUTPUT>
>  </CFLOOP>

it appears you are retrieving all the members of each category

here is a simpler, more efficient approach --

   <CFQUERY NAME="ONLY" ...>
       SELECT category, member_id
         FROM RRC_members
     ORDER BY category, member_id
   </CFQUERY>

   <CFOUTPUT QUERY="SECOND">
       #ONLY.member_id#<br>
   </CFOUTPUT>

rather than 1 query for the categories plus n queries, 1 for each of the n
categories, this is 1 query, total

i would recommend also outputting the category, otherwise the sequence is
hard to spot

rudy

-
You are subscribed to the CFUGToronto CFTALK ListSRV.
This message has been posted by: "rudy" <[EMAIL PROTECTED]>
To Unsubscribe, Please Visit and Login to http://www.CFUGToronto.org/
Manager: Kevin Towes ([EMAIL PROTECTED]) http://www.CFUGToronto.org/
This System has been donated by Infopreneur, Inc.
(http://www.infopreneur.net)

Reply via email to