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 ('空调', '洗衣机')
全部评论
相关推荐
07-22 15:08
门头沟学院 运营 牛客74745092...:记住不转正你就是爷
,既然每天能学到东西那就继续干,该几点走几点走,他们爱说说去,感觉学不到东西了再走。何况现在你都受不了这个氛围,就算转正了,过得也会很痛苦,该咋就咋,怂个蛋。

点赞 评论 收藏
分享
07-13 12:18
华南师范大学 Unity3D客户端 点赞 评论 收藏
分享