Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello all
I am making a sql query where i have 6 bit inputs.These inputs will be applicable in the where clause only when these are true. Means only that input will be applicable in the where clause which is true and rest of them will be ignored.Here combinations are also applied like if only 3 inputs are true and 3 are false.
Plz tell me whether I have to make all the cases using if else or is there any other/simpler way out.
Posted
Comments
OriginalGriff 15-Feb-14 3:37am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
perhaps an example would help us understand what the heck you are talking about?
Use the "Improve question" widget to edit your question and provide better information.
King Fisher 15-Feb-14 3:54am    
not clear

1 solution

Your question is not clear but I am giving an example. you must try if helps you. If Any one bit field is true so records can be display.

SQL
Select * from Table1 where Field1=1 or Field2=1 or Field3=1 or Field4=1 or Field5=1 or Field6=1


If you want to show data only when all bit fields are true so use this query

SQL
Select * from Table1 where Field1=1 and Field2=1 and Field3=1 and Field4=1 and Field5=1 and Field6=1
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900