Customers Who Never Order

来源:互联网 发布:网络通信公司简介 编辑:程序博客网 时间:2024/05/22 23:33

题意:找出customer从没有在order表中出现过的顾客的名字
解法:用内部链接选出所有在order表中出现过的顾客的名字,并作为新表,然后取出customer中没在该表中出现过的名字

select Customers.name from Customers where id not in(select Customers.id from Customers inner join Orders on Customers.id = Orders.CustomerId)
0 0
原创粉丝点击