ToB企服应用市场:ToB评测及商务社交产业平台

标题: Leecode SQL 183. Customers Who Never Order [打印本页]

作者: 万万哇    时间: 2024-10-2 21:58
标题: Leecode SQL 183. 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:
  1. SELECT c.name AS Customers
  2. FROM customers c
  3. WHERE c.id NOT IN(
  4.     SELECT c.id
  5.     FROM customers c
  6.         JOIN orders o
  7.             ON c.id = o.customerId
  8. )
复制代码
留意,不能按name筛选!会有重名!要按id!

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。




欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/) Powered by Discuz! X3.4