K
kthomas
I am trying to add up all "fertilizer" costs by customer name. However, I am
getting 3 results per customer due to there being 3 types of fertilizer. How
can I combine into one customer, one fertilizer total sales? Code below.
SELECT [SL Customers].[Customer Name], [SL Inventory].[Item Description],
Sum([qty]*[unit price]) AS Total
FROM (([SL Customers] RIGHT JOIN [SL Invoices] ON [SL Customers].[Customer
Number] = [SL Invoices].[Customer Number]) RIGHT JOIN [SL Items Sold] ON [SL
Invoices].[SOP Number] = [SL Items Sold].[SOP Number]) LEFT JOIN [SL
Inventory] ON [SL Items Sold].[Item Number] = [SL Inventory].[Item Number]
GROUP BY [SL Customers].[Customer Name], [SL Inventory].[Item Description]
HAVING ((([SL Inventory].[Item Description]) Like "*fertilizer*"))
ORDER BY Sum([qty]*[unit price]) DESC;
getting 3 results per customer due to there being 3 types of fertilizer. How
can I combine into one customer, one fertilizer total sales? Code below.
SELECT [SL Customers].[Customer Name], [SL Inventory].[Item Description],
Sum([qty]*[unit price]) AS Total
FROM (([SL Customers] RIGHT JOIN [SL Invoices] ON [SL Customers].[Customer
Number] = [SL Invoices].[Customer Number]) RIGHT JOIN [SL Items Sold] ON [SL
Invoices].[SOP Number] = [SL Items Sold].[SOP Number]) LEFT JOIN [SL
Inventory] ON [SL Items Sold].[Item Number] = [SL Inventory].[Item Number]
GROUP BY [SL Customers].[Customer Name], [SL Inventory].[Item Description]
HAVING ((([SL Inventory].[Item Description]) Like "*fertilizer*"))
ORDER BY Sum([qty]*[unit price]) DESC;