Some time ago I wrote short blog post on why use WHERE 1=1 in SQL. This time it’s why use WHERE 1=2, but really this can be WHERE 1=9 or anything that isn’t a 1, we just want the false statement.
A common SQL question is, why does anyone use WHERE 1=1 in their queries? And what does it do? The condition means WHERE TRUE, so it’s just bringing back the same query result as it would without.