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

绪风

关注

阅读 154

2022-05-18


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

题目大意:略。

解题思路:略。

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)

0 0 举报