MS Access - WHERE IN works, but WHERE NOT IN fails

后端 未结 1 1359
一生所求
一生所求 2021-01-15 07:52

I have the following query (simplified) on MS Access:

SELECT * FROM table1 WHERE table1.ID NOT IN (SELECT DISTINCT table1id FROM table2);

M

相关标签:
1条回答
  • 2021-01-15 08:26

    Generally, the problem with IN and NOT in has to do with NULLs in the subselect. Try this and see if it works:

    SELECT *
    FROM table1
    WHERE table1.ID NOT IN (SELECT DISTINCT table1id FROM table2 where tableid is not null);
    
    0 讨论(0)
提交回复
热议问题