condition cfqueryparam in cfquery
I need to add a cfqueryparam in cfquery like following. I want to know can I add if statement in cfqueryparam
<CFQUERY NAME="MyQuery" DATASOURCE="MyDataSource" USERNAME="MyUser" PASSWORD="MyPassword">
SELECT * FROM MyTable
WHERE MyField in <CFQUERYPARAM VALUE="#Trim(form.myText)#" >
</CFQUERY>
I want CFQUERYPARAM VALUE = 1,3,5 when my Check box1 is checked by user and CFQUERYPARAM VALUE = 2,4,6 when my check box2 is checked by user.
Is it possible to use an if statement or switch in CFQUERYPARAM to set value base on the check box on the form?
Basically, I need following SQL
Select * from MyTable where MyField in (1,3,5) when check box 1 checked on the form
Select * from MyTbale where MyField in (2,4,6) when check box 2 checked on the form
Your help and information is great appreciated,
Regards,
Iccsi
