Try this:
<cfquery name="qSpecialDetails" datasource="myotherdsn">
        select *
        from products
        where product_id IN(#valuelist(qGetSpecials.product_id)#)
</cfquery>

D
*************
Diana Nichols
Webmistress
http://www.lavenderthreads.com
770.434.7374

"One man's magic is another man's engineering." ---Lazarus Long


-----Original Message-----
From: Tony Gruen [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 29, 2001 2:05 PM
To: CF-Talk
Subject: RE: CFLOOP? Query results in a new query


Thanks Diana, I have this working where I need to output a list but my
challenge is specifically in using the query results for query1.product_id
to get those records from the main products table.

first I am running...

<cfquery name="qGetSpecials" datasource="mydsn">
        select product_id
        from    specials
</cfquery>

then I need to get those products that are on special from the main products
table...here is where i am stuck...

<cfquery name="qSpecialDetails" datasource="myotherdsn">
        select *
        from products
        where product_id = [i need to get the items from query qGetSpecials above]
</cfquery>

Tony Gruen





-----Original Message-----
From: Diana Nichols [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 29, 2001 10:11 AM
To: CF-Talk
Subject: RE: CFLOOP? Query results in a new query


<cfloop list="#valuelist(queryname.product_id)#" index="thisproductID">
#thisproductID#
<cfloop>

will give you a list of the values in the product_id field.

HTH

D
*************
Diana Nichols
Webmistress
http://www.lavenderthreads.com
770.434.7374

"One man's magic is another man's engineering." ---Lazarus Long

-----Original Message-----
From: Tony Gruen [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 29, 2001 12:49 PM
To: CF-Talk
Subject: CFLOOP? Query results in a new query


Deadline Tuesday and the simplest thing has me stumped. I am selecting
product_id from a table called 'specials'. I need to use the results of that
query to run another query from a huge 'Products' table.

I have been trying to get cfloop to deliver the list of product_id from
specials to the query from products with no success. I have not used cfloop
before and am unsure if it is the best way to do this. Please share
suggestions for alternative methods or hints on cfloop with me.

Tony Gruen
sfnetworks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to