首页 > 数据库技术 > 详细

mysql--从不订购的客户

时间:2019-10-09 13:39:22      阅读:80      评论:0      收藏:0      [点我收藏+]

技术分享图片                                                技术分享图片

 

解法一:(左外连接 + not null)

select A.Name as Customers
from Customers A left join Orders B
on A.Id = B.CustomerId
where B.Id is null

  

解法二:(not in + 子查询)

 

select Name  as Customers  from Customers c where c.Id not in(
    select CustomerId from Orders 
)

 

  

 

mysql--从不订购的客户

原文:https://www.cnblogs.com/vegetableDD/p/11641110.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!