Re: YTD Last year



Try this (not tested)

select *
from Salestable
Where Postingdate >= dateadd(year,datediff(year,0,getdate())-1,0)
and Postingdate <= dateadd(year,-1,getdate())

If you need this to follow very specific rules, check whether
this does what you want when there is a leap year issue (on
February 29, is last year's YTD supposed to be the same as it
was on February 28, or should it go through last March 1 and
stay a day ahead for the rest of the year?

Steve Kass
Drew University

Benedikt F wrote:

Hi there, I'd like to ask you for help with following:

I am trying to select YTD for last year in my sales table.

select *
from Salestable
Where Postingdate > "first day of 2004" and
Postingdate < "today last year"


best regards,
Benedikt F.
Computer Department
Iceland Seafood Int.





.