Main Body
SELECT
Employee.[Employee ID]
,Employee.[Last Name]
,Employee.[First Name]
,Orders.[Order ID]
,Orders.[Employee ID]
,Orders.[Order Date]
,Orders_Detail.[Unit Price]
,Orders_Detail.Quantity
,Product.[Product ID]
,Product.[Product Name]
,Product.[Product Type ID]
,Product.[Product Class]
,Product_Type.[Product Type Name]
FROM
Orders
INNER JOIN [Orders Detail] Orders_Detail ON Orders.[Order ID] = Orders_Detail.[Order ID]
INNER JOIN Employee ON Orders.[Employee ID] = Employee.[Employee ID]
INNER JOIN Product ON Orders_Detail.[Product ID] = Product.[Product ID]
INNER JOIN [Product Type] Product_Type ON Product.[Product Type ID] = Product_Type.[Product Type ID]
WHERE
Orders.[Order Date] in Date (2004, 01, 01) to Date (2004, 03, 31)
ORDER BY
@Quarter ASC -- Group #1
,SUM(@amount,Employee.[Last Name]) DESC
,Product.[Product Class] ASC -- Group #3
,Product_Type.[Product Type Name] ASC -- Group #4
,Product.[Product Name] ASC -- Group #5
Employee Sales Sub.rpt
SELECT
Employee.[Employee ID]
,Employee.[Last Name]
,Employee.[First Name]
,Orders.[Order ID]
,Orders.[Employee ID]
,Orders.[Order Date]
,Orders_Detail.[Unit Price]
,Orders_Detail.Quantity
,Product.[Product ID]
,Product.[Product Name]
,Product.[Product Type ID]
,Product.[Product Class]
,Product_Type.[Product Type Name]
FROM
Orders
INNER JOIN [Orders Detail] Orders_Detail ON Orders.[Order ID] = Orders_Detail.[Order ID]
INNER JOIN Employee ON Orders.[Employee ID] = Employee.[Employee ID]
INNER JOIN Product ON Orders_Detail.[Product ID] = Product.[Product ID]
INNER JOIN [Product Type] Product_Type ON Product.[Product Type ID] = Product_Type.[Product Type ID]
WHERE
Orders.[Order Date] in Date (2004, 01, 01) to Date (2004, 03, 31)
ORDER BY
@Quarter ASC -- Group #1
,SUM(@amount,Employee.[Last Name]) DESC
,Product.[Product Class] ASC -- Group #3
,Product_Type.[Product Type Name] ASC -- Group #4
,Product.[Product Name] ASC -- Group #5