- Customers Who Never Order
Write a solution to find all customers who never order anything.
Return the result table in any order.
The result format is in the following example.
Input
Customers =
idname1Joe2Henry3Sam4Max Orders =
idcustomerId1321 Output
CustomersHenryMax My solution:
- SELECT c.name AS Customers
- FROM customers c
- WHERE c.id NOT IN(
- SELECT c.id
- FROM customers c
- JOIN orders o
- ON c.id = o.customerId
- )
复制代码 留意,不能按name筛选!会有重名!要按id!
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |