Mysql学习总结(73)——MySQL 查询A表存在B表不存在的数据SQL总结

分享一个大神的人工智能教程。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到人工智能的队伍中来!点击浏览教程 

select rcr.* from raw_credit_request as rcr where  rcr.client_order_id not in 
(select co.client_order_id from credit_order as co);

select rcr.* from raw_credit_request as rcr where not exists (select 1 from credit_order 
as co where co.client_order_id =  rcr.client_order_id);

select rcr.* from raw_credit_request as rcr left join credit_order as co on 
(co.client_order_id =  rcr.client_order_id) where co.client_order_id is null;

方案一、

select A.* from raw_credit_request as A where  A.client_order_id not in (select B.client_order_id from credit_order as B);

方案二、

select A.* from raw_credit_request as A where not exists (select 1 from credit_order as B where B.client_order_id =  A.client_order_id);

方案三、

select A.* from raw_credit_request as A left join credit_order as B on (B.client_order_id =  A.client_order_id) where B.client_order_id is null;

©️2020 CSDN 皮肤主题: 技术黑板 设计师:CSDN官方博客 返回首页
实付 39.90元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值