with t as ( select a.product_id, product_name, quantity as quantity, right(sale_month,2) as month from products_underline a join sales_underline b on a.product_id=b.product_id where left(sale_month,4)=2024 and right(sale_month,2) in (1, 2, 3, 4, 5, 6) ) select DISTINCT product_id, product_name, sum(...