Hi Everyone,
I have this code in SQL that I can see the last 12 years of my data in the vb.net chart and what I am trying to do is to see also the last 12 months of my data starting from the current month that we currently are.
I use this code for my last 12 years view:
SELECT Sum(Price) As Total,
DATEPART(yyyy, Date) As [year],
Sum (CONVERT(INT, CONVERT(VARCHAR(MAX),quantity))) as Lesh
FROM dbo.Expenses
WHERE Date >= DATEADD(year, -12, GETDATE())
GROUP BY DATEPART(yyyy, Date)
and I want something similar to this but to give me the last 12 months of my data.
Thank you for your help.