I always build my SQL statements up dynamically in SQL but I guess you could
use a dummy clause and then build up the rest in a cfloop like so........
<CFQUERY DATASOURCE="#dns#">
SELECT *
FROM Homes
WHERE 1=1
<cfloop index="listname" item="word#>
AND ID = #word#
</cfloop>
</CFQUERY>
but surely this would bring back no records?....what I think you want is an
OR instead af an AND which means your dummy clause will have to change...
<CFQUERY DATASOURCE="#dns#">
SELECT *
FROM Homes
WHERE 0=1
<cfloop index="listname" item="word#>
OR ID = #word#
</cfloop>
</CFQUERY>
------------------------------------------------------------------
Andrew Ewings
Project Manager
Thoughtbubble Ltd
------------------------------------------------------------------
-----Original Message-----
From: Kevin Schmidt [mailto:[EMAIL PROTECTED]]
Sent: 06 September 2000 17:42
To: [EMAIL PROTECTED]
Subject: <CFQUERY> Question
This is a multi-part message in MIME format.
------=_NextPart_000_0177_01C017F7.6A6D41C0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I have a list that contains the ID of several items in a database. I =
want to run one query that will select them all from the database. =20
The number of items in the list is dynamic so I never know exactly how =
many I am pulling???
<CFQUERY DATASOURCE=3D"#dns#">
SELECT *=20
FROM Homes
WHERE ID =3D #listitem1# AND #listitem2# ETC.
</CFQUERY>
Any thoughts??
Kevin Schmidt
Internet Services Manager
Peterson, WIlliams & Bizer
Office: 734.995.5000
Mobile: 734.649.4843
------=_NextPart_000_0177_01C017F7.6A6D41C0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2920.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I have a list that contains the ID of =
several items=20
in a database. I want to run one query that will select them =
all from=20
the database. </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>The number of items in the list is =
dynamic so I=20
never know exactly how many I am pulling???</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><CFQUERY =
DATASOURCE=3D"#dns#"></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>SELECT * </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>FROM Homes</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>WHERE ID =3D #listitem1# AND =
#listitem2#=20
ETC.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></CFQUERY></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Any thoughts??</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Kevin Schmidt<BR>Internet Services=20
Manager<BR>Peterson, WIlliams & Bizer<BR>Office: =
734.995.5000<BR>Mobile:=20
734.649.4843<BR></DIV></FONT></BODY></HTML>
------=_NextPart_000_0177_01C017F7.6A6D41C0--
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.