find total sales per cateogry each year

PHOTO EMBED

Tue Mar 08 2022 07:55:08 GMT+0000 (Coordinated Universal Time)

Saved by @Bambibo9799

----temukan total pembelian terbanyak berdasarkan category tiap tahun

with t1 as(
select ct.category,sum(quantity) as totalbuy,extract(year from order_date) as datee
from orders_table as ot
join categories_table as ct
on ot.product_id = ct.productid
group by 1,3
)

select *
from t1
order by datee asc, totalbuy desc;
content_copyCOPY