use Northwind declare @d datetime declare @c int select @d = getdate() print @d print @d - 365*8 select @c = count(*) from Orders where ShippedDate > @d - 365*6 print @c