NULL values in where clause

后端 未结 6 764
花落未央
花落未央 2020-12-11 02:17

i\'ve got a table \"bla\" like this:

[id]    [name]    [fk]
1       test      4
2       foo       5
3       bar       NULL

if i do the sql

6条回答
  •  情书的邮戳
    2020-12-11 02:52

    NULL doesn't compare equal to anything. You'll need to accept nulls explicitly:

    where fk <> 4 or fk is null;
    

    See Working with NULL for more information about NULL handling.

提交回复
热议问题