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
Add a comment  | 

1 Answer 1

Reset to default 0

You 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