A bit complicated. Better WHERE 0=0 <cfif Len(form.orgname)> AND UPPER(orgname) LIKE UPPER(<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="%#Form.orgname#%">) </cfif> <cfif Len(form.funding)> AND UPPER(funding) LIKE UPPER(<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="%#Form.funding#%">) </cfif> <cfif Len(form.commapproval)> AND UPPER(commapproval) LIKE UPPER(<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="%#Form.commapproval#%">) </cfif>
-----Original Message----- From: Larry Juncker [mailto:[EMAIL PROTECTED] Sent: dinsdag 25 februari 2003 15:59 To: CF-Talk Subject: RE: Correct Syntax for this piece of SQL ?? Try this: <CFQUERY datasource="liv8" name="funding" cachedwithin="#CreateTimeSpan(0,6,0,0)#" blockfactor="100"> select * from funding <cfif form.orgname gt ""> Where orgname LIKE UPPER('%#Form.orgname#%') </cfif> <cfif form.funding gt ""> <cfif form.orgname gt "">AND<cfelse>WHERE</cfif> funding LIKE UPPER('%#Form.funding#%') </cfif> <cfif form.comapproval gt ""> <cfif form.orgname gt "" or form.funding gt "">AND<cfelse>WHERE</cfif> commapproval LIKE UPPER('%#Form.commapproval#%') </cfif> ORDER BY recordid </CFQUERY> This will generate a query based on which fields actually have values to search on. If I understand what you are wanting to do here. Larry Juncker Senior Cold fusion Developer Heartland Communications Group, Inc. [EMAIL PROTECTED] (515) 574-2122 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4