Question
When generating a top 3 customer result, Is it possible to include a sum value in it?
my current query:
Sum of Dollar | Customer
10 | A
8 | B
5 | C
desired query output
14 | B_Total
10 | A
5 | C
B_Total (14) is the sum of X (4), Y (3), Z (2) AND B (5)
And [History.CustomerNo] has Customer A, B, C, ... X, Y, Z.
Therefore, their common identifier is the table, [History] and parameter, [CustomerNo]
SQL:
SELECT TOP 3 Sum(History.DollarsSold) AS SumOfDollarsSold, History.CustomerNo
FROM dbo_SO_SalesHistory
WHERE (((sHistory.InvoiceDate) Between #8/1/2017# And #8/31/2017#))
GROUP BY History.CustomerNo
ORDER BY Sum(History.DollarsSold) DESC;
When generating a top 3 customer result, Is it possible to include a sum value in it?
my current query:
Sum of Dollar | Customer
10 | A
8 | B
5 | C
desired query output
14 | B_Total
10 | A
5 | C
B_Total (14) is the sum of X (4), Y (3), Z (2) AND B (5)
And [History.CustomerNo] has Customer A, B, C, ... X, Y, Z.
Therefore, their common identifier is the table, [History] and parameter, [CustomerNo]
SQL:
SELECT TOP 3 Sum(History.DollarsSold) AS SumOfDollarsSold, History.CustomerNo
FROM dbo_SO_SalesHistory
WHERE (((sHistory.InvoiceDate) Between #8/1/2017# And #8/31/2017#))
GROUP BY History.CustomerNo
ORDER BY Sum(History.DollarsSold) DESC;