Postgres NOT IN (null) gives no result

后端 未结 6 1331
长发绾君心
长发绾君心 2021-02-07 05:03

I\'m using Postgres with this query

select 
*
from Entity this_ 
where 
(this_.ID not in (null))

Why does this give me no results? I would expe

6条回答
  •  灰色年华
    2021-02-07 05:12

    select * 
    from Entity this_ 
    where (this_.ID not in (null))
    

    "IN" or "NOT IN" do not select NULL values You can write

    select * 
    from Entity this_ 
    where (this_.ID not in (1))
    

    And your selection will not contains null values

提交回复
热议问题