题目描述:
编写一个 SQL 查询,查询总销售额最高的销售者,如果有并列的,就都展示出来。
查询结果格式如下所示:
方法1:
主要思路:解题链接汇总
# Write your MySQL query statement below
select seller_id
from Sales
group by seller_id
having sum(price)=(
select sum(price)
from Sales
group by seller_id
order by sum(price)desc
limit 1
)
# Write your MySQL query statement below
select seller_id
from Sales
group by seller_id
having sum(price) >= all(
select sum(price)
from Sales
group by seller_id
)