Home Forums SQL Server 2008 SQL Server Newbies Get data for the past one year (365 days) RE: Get data for the past one year (365 days)
David Webb-CDS
SSCoach
Points: 17398
More actions
August 23, 2013 at 12:19 pm
#1644527
So it would have to be something like:
select ProdMonth ,ProdYear from Production
where ProdYear >= cast(datepart(yyyy,DATEADD(yyyy,-1,getdate())) as int)
I second Jeff's suggestion to store dates as dates.