Name: Anonymous 2012-09-26 7:51
So I'm doing some mostly menial programming task for some random company.
I've stumbled upon something though, that I cannot seem to figure out.
For MySQL, if I have this long select statement where all of the WHERE clause is optional, how do I handle that for integers? It's easy enough for Strings as you simply make a 0 char string when you initialize the variable, however for integers, you have to initialize them with something, which in this case is 0.
What this does is that when I have my SELECT statement, I can't just put in '%0%' as it would search for everything containing that 0. How do I make it think that the 0 is actually a null so it does not include it in the WHERE clause and is essentially ignored?
Not sure how else to explain the question.
I've stumbled upon something though, that I cannot seem to figure out.
For MySQL, if I have this long select statement where all of the WHERE clause is optional, how do I handle that for integers? It's easy enough for Strings as you simply make a 0 char string when you initialize the variable, however for integers, you have to initialize them with something, which in this case is 0.
What this does is that when I have my SELECT statement, I can't just put in '%0%' as it would search for everything containing that 0. How do I make it think that the 0 is actually a null so it does not include it in the WHERE clause and is essentially ignored?
Not sure how else to explain the question.