SELECT * FROM mytable WHERE col1='val1' AND col2='val2';
one of the parameters could be null and in this case i'd like it ignored. How can i do this without using ifs, since in the code i actually have 7 parameters and it's a hassle to check if every parameter is null;
i actually have 7 parameters and it's a hassle to check if every parameter is nul
I'm afraid that you will have to go through the hassle. How would you resolve this without checking it in your code, and dynamically creating the sql statement?