DEV Community

Discussion on: How to write SQL queries which are easier to read?

Collapse
 
jannikwempe profile image
Jannik Wempe

There is also one more big advantage in adding "1=1" to your WHERE-clause: You can add conditions dynamically without checking if there already is a condition. Without 1=1 as the first condition you have to check if you also have to add an "AND" (if condition 2+) or not (first condition).

Collapse
 
javinpaul profile image
javinpaul

Indeed, thanks for comment @Jannik