You mean like this: <cfquery name="qCart" datasource="dsMain" dbtype="ODBC"> SELECT ItemName, BrandName, RetailEach, RetailUnit, UnitSize, DetailedDescription, ItemNumber, MainCategory, SubCategory1, SubCategory2 FROM MasterItemTable WHERE 0=0 <cfif isdefined("URL.SubCategory1")> AND (SubCategory1 = '#SubCategory1#') <cfelse> OR (SubCategory2 = '#SubCategory2#') </cfif>
</cfquery> Steve > -----Original Message----- > From: Richard L Smith [mailto:[EMAIL PROTECTED]] > Sent: 17 December 2001 15:19 > To: CF-Talk > Subject: BrainFART: CFQuery conditional excecution > > > Hello, > > I trying to get this cfquery to run based on what link the user > clicks, i.e. if the user clicks > "somepage.cfm?SubCategory1=#SubCategory1#" then the first part of the > WHERE should execute else the the OR should execute. > I have tried CFQueryParam to no avail, here is the code > I am using so far. > > Rick > > <cfquery name="qCart" > datasource="dsMain" > dbtype="ODBC"> > SELECT ItemName, BrandName, RetailEach, RetailUnit, UnitSize, > DetailedDescription, ItemNumber, MainCategory, > SubCategory1, SubCategory2 > FROM MasterItemTable > <cfif isdefined(#SubCategory1#)> > WHERE (SubCategory1 = '#SubCategory1#') > <cfelse isdefined(#SubCategory2#)> > OR (SubCategory2 = '#SubCategory2#') > </cfif> > > </cfquery> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists