我正在使用MS Access。我写了这个查询...
INSERT INTO survey1 ( [Coach No] )
SELECT pvc1.[Coach No]
FROM pvc1 LEFT JOIN survey1 ON pvc1.[Coach No]=survey1.[Coach No]
WHERE (((survey1.[Coach No]) Is Null));
但是我的表调查1中没有附加数据......
答案 0 :(得分:2)
打破查询。只有select会返回任何结果吗?
SELECT pvc1.[Coach No]
FROM pvc1 LEFT JOIN survey1 ON pvc1.[Coach No]=survey1.[Coach No]
WHERE (((survey1.[Coach No]) Is Null))
答案 1 :(得分:1)
您的查询没有意义。您正在加入NULL
,然后尝试将NULL
插入到表中,作为最初来自的PK。您正在survey1
加入Coach No
,并尝试将Coach No
插回survey1
您要在此处做什么?
更新现在OP详细阐述了他想要做的事情:
INSERT INTO survey1 ( [Coach No] )
SELECT pvc1.[Coach No]
FROM pvc1
WHERE pvc1.[Coach No] NOT IN (SELECT [Coach No] FROM survey1 WHERE NOT [Coach No] IS NULL)