In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Filter a datetime variable to show results from previous 2 years in the SQL editor

willd9
7 - Meteor

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?

Error.png

2 REPLIES 2
davidskaife
14 - Magnetar

Hi @willd9 

 

As it's Oracle you could try ADD_MONTHS(SYSDATE, -24)

grazitti_sapna
17 - Castor

@willd9 , try using add_months instead of DateAdd function

 

where created_date >= add_months(sysdate, -24)

 

Sapna Gupta
Labels
Top Solution Authors