find each year sale in each city and state, then sum them all

PHOTO EMBED

Wed Mar 16 2022 09:17:39 GMT+0000 (Coordinated Universal Time)

Saved by @Bambibo9799

--find each sale for each city and state based on their yearly sale, and sum them all

select *, sum(sale)over(partition by yyyy)
from(
select city,state, extract(year from order_date ) as yyyy, sum(sales)as sale
from orders_table as ot
where state = 'New York'
group by 1,2,3
)t1
content_copyCOPY