/ Published in: SQL
One line to determine start of previous month
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
DECLARE @prevmonth datetime DECLARE @numprevious INT SET @numprevious = 2 SET @prevmonth = DATEADD(MONTH, DATEDIFF(MONTH,0,getdate())-@numprevious,0)