Now we’ve got two table. One customer table for customerid and their names, One Order tablefor customers’ Id that bought something.
We will find the customers that in the customer table but not in order table.
Method
Use NOT IN.
select Name from Customers
where Id not in
(select CustomerId from Orders order by CustomerId);

本文介绍了一种SQL查询技巧,通过使用NOT IN来找出存在于客户表中但未在订单表中出现过的客户记录。
923

被折叠的 条评论
为什么被折叠?



