0
点赞
收藏
分享

微信扫一扫

LeetCode(数据库)- 销售分析 I


题目链接:​​点击打开链接​​

题目大意:略。

解题思路:略。

AC 代码

-- 解决方案(1)
select
seller_id
from
sales
group by seller_id
having
sum(price) >= all(select sum(price) from sales group by seller_id)

-- 解决方案(2)
SELECT seller_id
FROM Sales
GROUP BY seller_id
HAVING SUM(price) = (SELECT SUM(price) SUMN FROM Sales GROUP BY seller_id ORDER BY SUMN DESC LIMIT 1)


举报

相关推荐

0 条评论