MySQL多表查询
文章目录
1. 两张表都有的记录
select * from Table_1 where exists (select Column_2 from Table_2 where Colomn_2=Table_1.Column)
2. 表一有表二没有的记录
select * from Table_1 where not exists (select Column_2 from Table_2 where Colomn_2=Table_1.Column)
3. 表二有表一没有的记录
select * from Table_2 where not exists (select Column_1 from Table_1 where Colomn_1=Table_2.Column)
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论