我有2个表,源名为" QA" ,目标表名为" Combine" 。我想仅根据[Call_ID]条件附加唯一记录。我需要 where子句的帮助,插入查询是:
INSERT INTO combine ( source, date_update, [Year], [Month], [Day], quarter, week, QAcount, sup, agent_name, QA_A, date_c, login_name, QA_CALL_ID )
SELECT "QA" AS source, Date() AS CURDATE, Year([date_c]) AS Y, Month([date_c]) AS M, Day([date_c]) AS D, DatePart('q',[date_c]) AS Q, Weekday([date_c],1) AS W, "1" AS [count], Roster.Supervisor, Roster.agent_name, QA.QA_A, QA.date_c, QA.login_name, QA.[Call ID]
FROM QA LEFT JOIN Roster ON QA.login_name = Roster.tCAM;
仅插入 [QA]。[来电ID] 与 [合并]不同。[QA_CALL_ID] AND不为空。请帮帮我这句话。
答案 0 :(得分:0)
WHERE [QA].[Call ID] <> [combine].[QA_CALL_ID] AND [combine].[QA_CALL_ID] NOT IS NULL
可能会遗漏Access喜欢使用大量的..的假设。