找出订单表中没有下单的顾客名称

顾客表 customers
id
name

id name
1 joe
2 henry
3 sam
4 max
订单表 orders
id
customerid
id customerid
1 3
2 1

求没有下单的顾客
select c.name as customers
from customers c
left join orders o
on c.id=o.customerid
where o.id is null
找出顾客表中顾客的名称
表联合后过滤出订单表中顾客id为空的

posted @ 2025-04-14 18:03  胖豆芽  阅读(15)  评论(0)    收藏  举报