我是Access的初学者。我写这个SQL语句:
INSERT INTO tbl_LaunchWeeklyPlan
IN 'C:\...\SomeDb.accdb'
SELECT ID, LaunchID, WeekYear, LaunchWeek, LaunchYear, Quantity, true AS IsActive
FROM tbl_LaunchWeeklyPlan t
WHERE t.ID NOT IN (SELECT ID
FROM tbl_LaunchWeeklyPlan
IN 'C:\...\SomeDb.accdb')
大约需要5分钟,表格中包含大约15 000条记录。
答案 0 :(得分:2)
您可以尝试使用外部联接。这可以更快地执行。
INSERT INTO tbl_LaunchWeeklyPlan IN 'C:\...\SomeDb.accdb'
SELECT ID, LaunchID, WeekYear, LaunchWeek, LaunchYear, Quantity, true AS IsActive FROM tbl_LaunchWeeklyPlan t
LEFT JOIN tbl_LaunchWeeklyPlan IN 'C:\...\SomeDb.accdb' f
ON t.ID = f.ID
WHERE f.ID = null