Mr. Ghiandino - 4 months ago 13x

SQL Question

How to set in SQL a where condition that is always true ???

As Far as I know: 'where 1=1', Are there other ways too?

Answer

Are you, by chance, talking about `collapse`

conditions, where a grouped condition is always `TRUE`

or `FALSE`

?

```
WHERE TRUE
WHERE 1
WHERE <string value> = <the same string value>
WHERE <numeric value> = <the same numeric value>
WHERE <hardcoded formula> = <the same hardcoded formula or one that produces the same value>
WHERE NULL IS NULL
```

Source (Stackoverflow)

Comments