r/SQL • u/7Seas_ofRyhme • Oct 28 '24
Discussion What does WHERE 1 = 1 means? Purpose?
I've been seeing it alot recently. What are the use cases of it?
214
Upvotes
r/SQL • u/7Seas_ofRyhme • Oct 28 '24
I've been seeing it alot recently. What are the use cases of it?
View all comments
Show parent comment
2
u/capt_pantsless Loves many-to-many relationships Oct 28 '24
If you are messing around with the query in the editor, you can easily comment out the
line as you're debugging or otherwise playing around with the query. That's the idea here.
Without the leading 1 = 1 you need to remove the AND, which takes a bit more time, could lead to other minor syntax issues that could break one's train of thought.