选择存在于tA表中,但其中name不同于tB表中的数据 select id, name, gender, classId from tA where not exists (select name from tB where tA.name=tB.name) not in 的写法,同样的效果,但是在大数据量的时候 效率不高 select id, name, gender, classId
选择存在于tA表中,但其中name不同于tB表中的数据
select id, name, gender, classId from tA where not exists (select name from tB where tA.name=tB.name)
not in 的写法,同样的效果,但是在大数据量的时候效率不高
select id, name, gender, classId from tA where name not in (select name from tB where tA.name=tB.name)
或者
select id, name, gender, classId from tA where name not in (select name from tB)
如果选取和排除的字段数目相等,还可以用except方法,但是注意它会去除重复的数据(有点类似于union和union all的区别,不过并没有except all这种用法)
select name from
tA except select name from
tB
Copyright © 2019- baomayou.com 版权所有 赣ICP备2024042794号-6
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务