Hello,
I am wrapping my brain around joining these 3 queries into 1 statement. I am in the midst of learning SQL and needless to say, I am starting to get lost
I am trying to answer this question:
List the employees and their total merchandise sales expressed as a percentage of total merchandise sales for all employees.
SELECT Sale.EmployeeID, Sum(SaleItem.SalePrice) AS SumOfSalePrice
FROM Sale INNER JOIN SaleItem ON Sale.SaleID = SaleItem.SaleID
GROUP BY Sale.EmployeeID;
SELECT Sum(SaleItem.SalePrice) AS TotalMerchandiseSales
FROM SaleItem;
SELECT Employee.EmployeeID, Employee.LastName, Employee.FirstName, Employee.Title, EmployeeTotalSalesMerch.SumOfSalePrice, [SumOfSalePrice]/[TotalMerchandiseSales] AS PercentofSales
FROM TotalSalesAllEmployees, Employee INNER JOIN EmployeeTotalSalesMerch ON Employee.EmployeeID = EmployeeTotalSalesMerch.EmployeeID
ORDER BY [SumOfSalePrice]/[TotalMerchandiseSales] DESC;
Sincere thanks to anyone that can provide some insight.