-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
At least one answer is simply incorrect (the very last one, showing total & 1997 revenues per customer - the total for the CENTC customer doesn't match). And many of them can be simplified considerably (including that one, which I have as
SELECT CustomerID, CompanyName, Country,
(SELECT ISNULL(SUM(Subtotal),0) FROM OrderSubTotals WHERE Year(OrderDate)=1997 AND OrderSubTotals.CustomerID = Customers.CustomerID) Sales97,
(SELECT ISNULL(SUM(Subtotal),0) FROM OrderSubTotals WHERE OrderSubTotals.CustomerID = Customers.CustomerID) SalesTotal
FROM Customers
ORDER BY SalesTotal
(after creating OrderSubTotals to add OrderDate and CustomerID to the [Order Subtotals] VIEW).
Metadata
Metadata
Assignees
Labels
No labels