查找另一个表后从一个表中删除 - SQL
嗨
我有两个表
Invited
- UID [pk]
Active
- UID [pk]
我想从 Active 中存在的
表Invited
中删除 UID
我可以通过加入来做到这一点还是唯一的方法是使用 NOT IN 或 IN
?
Hiii
I have two tables
Invited
- UID [pk]
Active
- UID [pk]
I want to delete UID from Invited
who is present in Active
table
Can i do this with Joining or the only approach is to use NOT IN or IN
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,您可以使用
IN
。从 UID 所在的受邀者中删除(从活动中选择 UID)
或者,如果您愿意,您可以使用加入
Yes you can use
IN
.Delete From Invited where UID in (Select UID From Active)
Or you can use a Join if you want to
或者,为了提高性能:
or, for a performance improvement: