ssm icon indicating copy to clipboard operation
ssm copied to clipboard

按导演分组计算销售总额,求出平均销售额冠军(统计结果过滤掉只有单部电影的导演,列出导演名,总销量,电影数量,平均销量) (unfinished)

Open SchopenhauerZhang opened this issue 4 years ago • 0 comments

SELECT director,sum(Domestic_sales+International_sales),count(title) as ag,sum(Domestic_sales+International_sales)/count(1) as acg

FROM movies

left join Boxoffice

on Boxoffice.Movie_id = movies.id

group by director

having ag > 1 order by acg desc limit 1

;

http://www.zhangxiaoshuai.fun/2020/01/15/%E3%80%90sql%E3%80%91sql%E8%AF%AD%E5%8F%A5%E7%9A%84%E7%BB%83%E4%B9%A0/

SchopenhauerZhang avatar Jul 03 '20 10:07 SchopenhauerZhang