Well, that will always create an invalid SQL statement, either:

select *
from tbl
where or name = somename
        
OR 

select *
from tbl
where id = someid or


One working way would be

select *
from tbl
<cfif firstcondition OR secondcondition>
        where 
        <cfif firstcondition>
                firstwhere
        </cfif>
        <cfif firstcondition AND secondcondition>
                OR
        </cfif>
        <cfif secondcondition>
                secondwhere
        </cfif>
</cfif>



-----Original Message-----
From: Dan Donnick [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 28, 2000 12:36 PM
To: CF-Talk
Subject: conditional where statement


is this correct or am i missing something?

select *
from tbl
where <cfif isdefined(")>
        id = #id#
        </cfif>
        or
        <cfif isdefined(")>
        name = #name#
        </cfif>
______________________________

Dan Donnick
Cold Fusion Developer
Bixler Incorporated
1250 24th Street
Suite 250
Washington, DC 20037
P: (202) 686-5800
F: (202) 686-5801
______________________________

----------------------------------------------------------------------------
--
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.

Reply via email to