We use analytics and advertising cookies to understand how the site is used and whether our ads on Facebook and Instagram work. They are set only if you accept. See our Privacy Policy for details.
Use two chained CTEs: the first computes revenue (price times summed quantity) per product, the second sums that to revenue per 'category'. Return the 'category' and 'category_revenue' for the single highest-revenue category.