rather than looping over your query, i think you can likely get what you need with an in statement :
 
<cfset list = �John,Mike,Luke�>
<cfquery name="GetGroupQ" datasource="DSN">
SELECT *
FROM EmailSystem_Groups
WHERE GroupName in (#listQualify(EmailList, "'")#)
</cfquery>
the listQualify() function puts qualifiers around your list elements, in this case single quotes.
 
---
 
to append the values of a column in list fasion to another, you can simply do this :
 
<cfset newList = listChangeDelims(listAppend(oldList, "," & valueList(queryName.columnName), ","), ",",",")>
 
basically the above is appending the two lists together, the valueList() function makes a list of the query values of a specified column, the listChangeDelims() call will remove the extra comma if it is not needed.
 
 
nate
 
----- Original Message -----
Sent: Wednesday, November 17, 2004 3:58 PM
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

Reply via email to