I have a year & month in my database tables seperate column.(like Year 2017 , Month 8) I need to filter that data for I need past year data from today. I want 13 months of data to be returned.
If today is 13/8/2018 and i need data From 8/2017 to 8/2018 only.
I tried it like this,
SELECT Year,Month,News
FROM TBL_NEWS
WHERE Year >= cast(datepart(yyyy,DATEADD(yyyy,-1,getdate()))