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
NULL is not a value, but rather the unknown absence of a value. If you'd like to test for NULL, you have to do so explicitly by using IS NULL
and IS NOT NULL
. For example, NULL will test FALSE even against NULL itself. So, working with NULL is only done with the aforementioned functions (and ISNULL()
). Your query could be rewritten as
SELECT * FROM bla WHERE fk <> 4 OR fk IS NULL