Why would someone use WHERE 1=1 AND in a SQL clause?

后端 未结 19 2206
甜味超标
甜味超标 2020-11-22 07:08

Why would someone use WHERE 1=1 AND in a SQL clause (Either SQL obtained through concatenated strings, either view definition)

I\'ve

19条回答
  •  青春惊慌失措
    2020-11-22 07:51

    Seems like a lazy way to always know that your WHERE clause is already defined and allow you to keep adding conditions without having to check if it is the first one.

提交回复
热议问题