SELECT CAST(SUM(Cust.[Sales (LCY)]) AS decimal(8 , 2)) AS Totalsales, Cust.[Customer No.], Customer.Name FROM [Cust. Ledger Entry] AS Cust INNER JOIN Customer ON Cust.[Customer No.] = Customer.[No.] WHERE (Cust.[Document Type] = 2) AND (YEAR(Cust.[Posting Date]) = YEAR(GETDATE())) GROUP BY Cust.[Customer No.], Customer.Name ORDER BY Totalsales DESC
@LastYear = DateAdd(yyyy, -1, GetDate()) @TwoYearsAgo = DateAdd(yyyy, -2, GetDate())
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)