with sale_temp as ( select o.product_id,product_name, sum(quarter_1_sales_amount+quarter_2_sales_amount+quarter_3_sales_amount+quarter_4_sales_amount) as total_sales_amount_of_product from oppo_products_detail o join sales_info s on s.product_id=o.product_id group by o.product_id ) select st.product_id,product_name,competitor_name,total_sales_amount_of_product, total_sales_amount_of_product-total_competitor_sales_amount_2023 as sales_difference_with_competitor from sale_temp st join competitor_analysis c on c.product_id=st.product_id order by product_id;

京公网安备 11010502036488号