Neal,
 
    The way your example is written, you will be doing one query for each item in the list.  Even with a list as small as the one in the example, you would want to avoid this; I can only imagine how long your template would take to execute if you did this with a much larger list.
 
    My suggestion is that instead of executing one query for each list item, you append part of the WHERE clause to a string variable containing your SQL.  Then you can execute that SQL within your <cfquery>, getting all of the results in a single query that you can loop over afterwards.  In the loop following the query, snag the e-mail address and ListAppend() it into a new list.
 
    Hope this helps,
 
    Eric
-----Original Message-----
From: Bailey, Neal [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 17, 2004 3:59 PM
To: [EMAIL PROTECTED]
Subject: All Loopy over Loops - Need Help

Hey guys...

 

Man I am stuck in a loop...

 

I have this query that I need to loop through and then somehow pull data out of the query and append it to another comma delimited list. Any ideas on how I would go about this. Its got my all loopy.

 

Here is kind of an example of what I am trying to do:

------------------------------------------------------------------

<cfset list = "John, Mike, Luke">

 

<cfloop index="EmailList" list="#list#" delimiters=",">

<cfquery name="GetGroupQ" datasource="DSN">

SELECT *

FROM EmailSystem_Groups

WHERE GroupName = '#EmailList#'

</cfquery>

</cfloop>

------------------------------------------------------------------

 

Ok so I loop through the query to get their email address, but I want to also insert or append the email address into another list like:

 

SESSION.EmailList = "[EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]"

 

...because later on I run this list through another loop process.

 

This is just an example. Its not even email data that I'm pulling.

 

Hopefully this makes sense.

 

Thanks...

Neal Bailey


CONFIDENTIALITY NOTICE: The information contained in this e-mail and attached document(s) may contain confidential information that is intended only for the addressee(s). If you are not the intended recipient, you are hereby advised that any disclosure, copying, distribution or the taking of any action in reliance upon the information is prohibited. If you have received this e-mail in error, please immediately notify the sender and delete it from your system.

Reply via email to