I have a table with applicationdate
as one of its columns. I need to filter up to the past 3 months and not just three months ago from today, that is, if today is 9/26/2022
, I would like to filter from 6/1/2022
, and not 6/26/2022
.
This code pulls the three months ago from today
SELECT *
FROM table
WHERE applicationdate >= DATEADD(month, -3, applicationdate)
resulting to 6/26/2022. I am interested up to 6/1/2022
According to some googling, I can use trunc()
, datetrunc()
or date_trunc()
to get the first day of the three months ago, but each of them throws a function error saying:
'function' is not a recognized built-in function name.
How can I filter to the first of three months ago?