Answer the question
In order to leave comments, you need to log in
How to subtract 1 day from a quarter?
Hello!
You need to get data with the creation date "greater than or equal to the current quarter - 1 day". Tried like this:
datepart(dd, CreatedDate) >= dateadd(dd, -1, DATEPART(qq, getdate()))
and datepart(yy, CreatedDate) = datepart(yy, GETDATE())
Answer the question
In order to leave comments, you need to log in
select dateadd(qq, datediff(qq, 0, getdate()), 0) -- начало текущего квартала
select dateadd(dd, -1, dateadd(qq, datediff(qq, 0, getdate()), 0) ) -- начало текущего квартала - 1 день.
-- CreatedDate >= dateadd(dd, -1, dateadd(qq, datediff(qq, 0, getdate()), 0) )
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question