mysql--从不订购的客户                                                mysql--从不订购的客户

 

解法一:(左外连接 + 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 
)

 

  

 

相关文章:

  • 2021-05-14
  • 2022-02-08
  • 2022-12-23
  • 2021-11-19
  • 2021-12-24
  • 2021-10-05
  • 2021-11-26
  • 2022-12-23
猜你喜欢
  • 2021-11-07
  • 2021-08-24
  • 2021-05-17
  • 2021-09-19
  • 2022-12-23
  • 2022-12-23
  • 2021-06-15
相关资源
相似解决方案