Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
fyroc58609yIt being an AND statement is weird but I do 1=1 if I need to do condition statements in the WHERE clause.
-
@LMestre14 You don't have to worry about where your last WHERE is, you can just keep building them as AND when looping through conditions, then hard code the ; at the end.
And [code blah] and [blah] and [blah] and 1=1; -
geschwint69yI also use to easily enable/disable test "where" statements:
where (
1=1
or
(
Col1=value
and
Col2=value
)
or
...
Just to keep the tests without removing them
Related Rants
Why?
SELECT ...
FROM ...
WHERE ... AND 1=1;
undefined
sql