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 ('空调', '洗衣机')
全部评论
相关推荐
点赞 评论 收藏
分享
03-15 18:52
华中师范大学 Java 淮竹c:不好意思,打扰大家🙏我是一个拼多多骑手,小电驴的最大电量为C,我的最大电量有1e9这么promax😭😭😭需要从x=0处走到x=L,L足足有1e9那么长处,途中有n个充电站,🙏🙏每个充电站的距离和电价分别为di和pi,初始电量是满的😭😭😭请告诉我到达终点最少要花多少钱😭😭😭求求大家把这些钱转给我
查看2道真题和解析 点赞 评论 收藏
分享
