select
su.product_id,
pu.product_name,
sum(quantity) as total_sales,
max(quantity) as max_monthly_sales,
min(quantity) as min_monthly_sales,
round(sum(quantity) / count(su.product_id),0) as avg_monthly_sales
from
sales_underline as su
left join
products_underline as pu
on
su.product_id = pu.product_id
where
sale_month between '2024-01' and '2024-06'
group by
su.product_id


京公网安备 11010502036488号