i'm trying to build logic into a MS SQL connecter to only pull the past 3 years of data,
I have tried using the DATEADD function and DATESUB but neither seem to work.
The error I get is 'wrong syntax near Current_date'
Any advice? !
@kav_100 You will need to include the following to the end of your query:
WHERE YEAR(`DateField`) >= YEAR(CURRENT_DATE()) - 3
@kav_100
Without seeing your SQL code,
CURRENT_DATE doesn't exist in MS SQL. You can use GETDATE in it's place. Alternatively use CURRENT_TIMESTAMP
CURRENT_DATE
GETDATE
CURRENT_TIMESTAMP