Retrieve total sales amount for each product category and display them in separate columns.
SELECT SUM(CASE WHEN product_category = ‘Category A’ THEN sales_amount ELSE 0 END) AS Category_A_Sales, SUM(CASE WHEN product_category = ‘Category B’ THEN sales_amount ELSE 0 END) AS Category_B_Sales, SUM(CASE WHEN product_category = ‘Category C’ THEN sales_amount ELSE 0 END) AS Category_C_Sales FROM table_name
Ready to get instant access to all your company data ?
Connect 300+ sources, serve any BI tool, and give every AI agent one governed endpoint to read, and write back where the app supports it.
14-day free trial
No credit card needed
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.