Write a prepared statement with nullable values in conditions
问题 Is there a way to write a prepared statement where a value is compared to another value in a condition and I don't know, whether this value is NULL or not. SELECT `foo` FROM `bar` WHERE `a1` = :a1 AND `a2` = :a2 If I would use this prepared statement with a1 => null and a2 => 42 , then the resulting query would be: SELECT `foo` FROM `bar` WHERE `a1` = NULL AND `a2` = '42' This is, of course, not what I want. I would need this in that case: SELECT `foo` FROM `bar` WHERE `a1` IS NULL AND `a2` =