
June 4th, 2004, 09:05 AM
|
|
Registered User
|
|
Join Date: Jun 2004
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Code for yesterdays date last year
Hello. I am trying to write the code that tracks invoices between the first day of the current quarter last year and yesterday's date last year. Here is the code that shows all invoices from the first date of the current quarter last year to today's date last year, but I want to stop on yesterdays date last year. Any suggestions?
Code:
select Sum(dollarshipments) as dollarshipments from salesbydate where dateinvoice BETWEEN dateadd(q, datediff(q,0,dateadd(yy, -1, getdate())), 0) AND dateadd(yyyy, -1, getdate() - 1)
|