sql 有且仅有
查询订单表里有且仅购买空调和洗衣机的订单数
with a as (
select
orderid,
count(distinct category)
from
tbl_order
group by orderid
having count(distinct category) = 2
)
select
count(distinct a.orderid)
from a
left join tbl_order as o on a.orderid = o.orderid
and category in ('空调', '洗衣机')
with a as (
select
orderid,
count(distinct category)
from
tbl_order
group by orderid
having count(distinct category) = 2
)
select
count(distinct a.orderid)
from a
left join tbl_order as o on a.orderid = o.orderid
and category in ('空调', '洗衣机')
全部评论
相关推荐
点赞 评论 收藏
分享
点赞 评论 收藏
分享
2025-12-24 14:43
临沂大学 Java
yuyulin:跟老师求情,让父母打电话求情也可以,说以后不会逃课了,这是最理想的;最坏的就说自己有抑郁症,接受不了休学的结果,可能会做出冲的的行为(自行设想哈哈),大学辅导员最怕这个,我们学校有个哥们每次就拿条楼作为底牌,辅导员都不管他了,睁一只眼闭一只眼 点赞 评论 收藏
分享
点赞 评论 收藏
分享

