admin管理员组文章数量:1123008
I have applied the group by function to sum a category in Hive. I am currently selecting by individual year from the database (where year = "2015").
How do I apply another group by so that the information is outputted for each year in the database?
select year, product,
sum(sales)
from database
where year = "2015"
group by year, product
order by product asc;
I have applied the group by function to sum a category in Hive. I am currently selecting by individual year from the database (where year = "2015").
How do I apply another group by so that the information is outputted for each year in the database?
select year, product,
sum(sales)
from database
where year = "2015"
group by year, product
order by product asc;
Share
Improve this question
asked 1 hour ago
Dave DigglerDave Diggler
134 bronze badges
1 Answer
Reset to default 0You already have done group by year and product, if you need to select each year instead of only 2015 you can delete where year = "2015"
and it will work
本文标签: sqlAdding another groupby in HiveStack Overflow
版权声明:本文标题:sql - Adding another groupby in Hive - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736540545a1944382.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论