/****************************************************************************************/
/*																						*/
/*	Kroenke, Auer, Vandenberg, and Yoder - Database Concepts (8th Edition) Chapter 08	*/
/*																						*/
/*	Heather Sweeney Designs Data Warehouse Database Case question 8-52 I,J				*/
/*																						*/
/*	These are the Microsoft SQL Server 2016 code solutions								*/
/*																						*/
/****************************************************************************************/


/* ******** Exercise 8.528.I Query  ******************************************/

SELECT		C.CustomerID, C.CustomerName, C.City,
			P.ProductNumber, P.ProductName,
			SUM(PS.Total) AS TotalDollarSales
FROM		CUSTOMER C, PRODUCT_SALES PS, PRODUCT P
WHERE		C.CustomerID = PS.CustomerID
			AND P.ProductNumber = PS.ProductNumber
GROUP BY	C.CustomerID, C.CustomerName, C.City,
			P.ProductNumber, P.ProductName
ORDER BY	C.CustomerID, P.ProductNumber;

