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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Last FULL month 1

Status
Not open for further replies.

cpagano

Technical User
Mar 14, 2008
12
0
0
US
I want a query that always gathers its data for the last FULL month..
Ive tried this ..


where adm_ts >= DATEADD(month,-1,GETDATE())

But it seems to go back 30 days from today,
I need to run Feb in March, ect..

Thanks

 

WHERE adm_ts >= DATEADD(MONTH, DATEDIFF(MONTH, 31, CURRENT_TIMESTAMP), 0),
AND adm_ts < DATEADD(MONTH, DATEDIFF(MONTH, 0, CURRENT_TIMESTAMP), 0)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top