Good afternoon,
It has been about 25 years since I last used databases so I am a little rusty.
I have the following query...
SELECT Invoice, SalesID, First(Customer) AS Cust, First(BookoutDate) AS BODt, Sum(Quantity) AS Qty, Sum(Cost) AS Cst, Sum(SellPrice) AS Sell, Sum(GrossProfit) AS GP
FROM Sales082017
WHERE Invoice <> "0"
GROUP BY Invoice, SalesID
UNION SELECT Invoice, SalesID, First(Customer) AS Cust, First(BookoutDate) AS BODt, Sum(Quantity) AS Qty, Sum(Cost) AS Cst, Sum(SellPrice) AS Sell, Sum(GrossProfit) AS GP
FROM Sales092017
WHERE Invoice <> "0"
GROUP BY Invoice, SalesID;
Which doesn't quite do what I want it to.
It groups everything together, but only per month
EG: I might have the following lines that were meant to be grouped together, but because they are from different tables, they are seperate
Invoice SalesID Cust BODt Qty Cst Sell GP 1629418 6316 Sample Customer 16/08/2017 5 $225.78 $208.70 -17.08 1629418 6316 Sample Customer 1/09/2017 2 -$84.74 -$0.01 84.73
Any assistance would be great thanks