I've input data from a table called 'Tasks' which I'm trying to filter by created_date to only show results created in the last 2 years. Here is the code I've attempted:
select distinct tasks.course
from tasks
where tasks.course is not null
and tasks.created_date >= dateadd(year, -2, getdate())
When I click 'Test Query', I get the below error message. Any ideas?
Solved! Go to Solution.
@willd9 , try using add_months instead of DateAdd function
where created_date >= add_months(sysdate, -24)