I have the following query, however if I enter more than one value in the search form such as

Surname = Vaughan
Funding = budget

<CFQUERY datasource="liv8" name="funding">
SELECT * FROM funding
WHERE 1=1

<cfif Len(Trim(form.orgname))>
    AND UPPER(orgname) LIKE UPPER(<cfqueryparam cfsqltype="CF_SQL_VARCHAR"
value="%#form.orgname#%">)

<cfelseif Len(Trim(form.funding))>
    AND UPPER(funding) LIKE UPPER(<cfqueryparam cfsqltype="CF_SQL_VARCHAR"
value="%#form.funding#%">)

<cfelseif Len(Trim(form.surname))>
    AND UPPER(surname) LIKE UPPER(<cfqueryparam cfsqltype="CF_SQL_VARCHAR"
value="%#form.surname#%">)

<cfelseif IsNumeric(form.commyearfrom) AND IsNumeric(form.commmonthfrom)
AND IsNumeric(form.commdayfrom) AND IsNumeric(form.commyearto) AND
IsNumeric(form.commmonthto) AND IsNumeric(form.commdayto)>

   
AND IssueDate BETWEEN
    TO_DATE('#form.commyearfrom#-#form.commmonthfrom#-#form.commdayfrom#','YYYY-MM-DD')
    AND
    TO_DATE('#form.commyearto#-#form.commmonthto#-#form.commdayto#','YYYY-MM-DD')


</cfif>
</CFQUERY>

----------------------

This is the output from debugging

[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to