Compute the percent of sales where ProductType="Widgets", grouped by Quarter and Region. This query combines totals on all elements of a grouping (total sales) with totals on a filtered set of elements (sales for "Widgets" only).

RETURN Results AS
SELECT 
  (SUM(Amount) WHERE ProductType='Widgets') /
   SUM(Amount) AS PctWidgets
GROUP BY Quarter, Region


Copyright © Legal Notices