Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code to retrieve dates for prior year

Status
Not open for further replies.

TallGuyinIT

IS-IT--Management
Oct 18, 2004
34
US
I am not familiar with the SQL program language. I am just trying to make a quick modification to a program. The program is suppose to pull records from 01/01/lastyear to today/lastyear (01/01/2006-05/17/2006). I can tell that the code is not correct based on the data retrieved. Can anyone give me a fix? The current code reads:

WHERE inv_hdr.inv_date >= dateadd(d,-datepart(dy,getdate()-360) + 1,getdate()-360) -- Last years Jan 1.
AND inv_hdr.inv_date <= dateadd(yyyy,-1,getdate()) -- Todays date last year

Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top