I have a SQL view with the criteria below, I'm trying to get last months transactions. My criteria works most of the time except in month 1 of the year.
WHERE (DATEPART(yyyy, dbo.SLPostedCustomerTran.TransactionDate) = DATEPART(yyyy, DATEADD(m, - 1, GETDATE()))) AND (DATEPART(m, dbo.SLPostedCustomerTran.TransactionDate) = DATEPART(m, DATEADD(m, - 1, GETDATE())))
Can anyone help?