开发者

Problem in append query in MS ACCESS sql

I am using MS Access. I have written this query...

INSERT INTO survey1 ( [Coach No] )
SELECT pvc1.[Coach No]
FROM p开发者_C百科vc1 LEFT JOIN survey1 ON pvc1.[Coach No]=survey1.[Coach No]
WHERE (((survey1.[Coach No]) Is Null));

BUT it is not appending data in my table survey1...


Break the query up. Does just the select return any results?

SELECT pvc1.[Coach No]
FROM pvc1 LEFT JOIN survey1 ON pvc1.[Coach No]=survey1.[Coach No]
WHERE (((survey1.[Coach No]) Is Null))


Your query doesn't make sense. You are joining on NULL, then you try to insert that NULL into a table as a PK where it originally came from. You are joining with survey1 on Coach No and are trying to insert the Coach No back into survey1 What are you trying to do here?

Update now that OP elaborated on what he wants to do:

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)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜