I have 2 tables
Table 1 tbl1
ID | Name
1 | stack
Table 2 tbl2 (empty table)
ID | Name
I have this query
SELECT id FROM tbl1 WHERE id != (SELECT id FROM tbl2)
My subquery returns null which means the WHERE comparison is id != null and since my id = 1, shouldn’t it display the id 1?
However I keep getting zero or no rows returns. Why is that?
I really don’t know, but have you tried
SELECT id FROM tbl1 WHERE id NOT IN (SELECT id FROM tbl2)