Try this:

<cfset results = valuelist(get_rec_4month.recipeID)>

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]

Sent: Wednesday, November 29, 2006 7:38 PM
To: CF-Talk
Subject: CFQUERY: comma delimited list of id values

All,

I'm trying to figure out how best to pass a list of comma delimited id
(numeric) values to
another query. I'm having trouble with getting the list of id values to
not have a "," (comma) 
after the last value in the output.  Any help would be very appreciated.

Should I be using a cfloop instead on the 2nd section below?


<!--- 1 - GET RECIPES FOR PRE SELECTED MONTH AND YEAR --->
 <CFquery name="get_rec_4month" datasource="#datasource#">
  select *
  from dbo.tbl_recipe_monthly_winner
  where (month(recw_assign_month )= 01)  AND (year(recw_assign_month )=
2006) 
 </CFquery>

<!--- 2 - OUTPUT VALUES IN QUERY TO GET COMMA DELIMITED LIST OF ID
VALUES --->
 <cfoutput query="get_rec_4month">
  <CFSET results = #get_rec_4month.recipeID#,>
 </cfoutput>

<!--- 3 - QUERY TABLES WHERE COMMA DELIMTED LIST IN IN WHERE CLAUSE --->

<cfquery name="sfc_all_recipes" datasource="#recipes#">
 SELECT     *, dbo.recipeingredients.ingredients,
dbo.addresses.firstname, dbo.addresses.lastname, 
 dbo.recipes.recipeID, dbo.recipes.recipename, dbo.recipes.recipedesc,
dbo.recipes.instructions,  dbo.recipes.imageID
 FROM dbo.recipes INNER JOIN dbo.addresses ON dbo.recipes.addressID =
dbo.addresses.addressID INNER JOIN
 dbo.recipeingredients ON dbo.recipes.recipeID =
dbo.recipeingredients.recipeID
 WHERE dbo.recipes.recipeID IN #results#
</cfquery>    

Thanks.

D



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:261997
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