将信息从一个表移动到另一个表,然后从其源中删除该数据
我正在制作一个名册创建工具,该工具的一部分是将毕业的学生从名册池中删除,并将其放入另一个名为 CompletedArchive 的表中。将它们复制到另一个表后,我希望将它们从 RosterPool 表中删除。
INSERT INTO CompletedArchive ( Rate, FullName, Last4, Graduated )
SELECT RosterPool.Rate, RosterPool.FullName, RosterPool.Last4, RosterPool.Graduated
FROM RosterPool
WHERE ((RosterPool.Graduated)="Yes");
我无法找到在哪里添加 DELETE 语句并且不会出现错误。任何帮助表示赞赏!
I'm making a roster creation tool and one part of the tool is to remove the graduated students from the roster pool and put them into another table called CompletedArchive. After they are copied to the other table I want them to be deleted from the RosterPool table.
INSERT INTO CompletedArchive ( Rate, FullName, Last4, Graduated )
SELECT RosterPool.Rate, RosterPool.FullName, RosterPool.Last4, RosterPool.Graduated
FROM RosterPool
WHERE ((RosterPool.Graduated)="Yes");
I cannot find out where to add the DELETE statement and not get an error. Any help is appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须在此处运行两个不同的命令:
然后
此外,请确保在同一事务中运行这两个命令。这样,如果出现任何问题,您将有机会回滚。
You have to run two different commands here:
and then
Also, make sure you run the two commands within the same transaction. That way you will have the chance to rollback if anything goes wrong.