Retool Database get record where date < 2 month in the future

Hi,
I'm struggling with a query to Retool Database.
I have an end_date column on my contract table, and I'd like to query all records where this date is less than in 90 days / 3 months.

The query I'm using is the following:

SELECT *
FROM contract
WHERE 
  end_date < dateadd(month, +3, getdate())

and I get the following error:

column "month" does not exist

I understand Retool doesn't recognize the month parameter from the dateadd() function, but I'm stuck on how to implement this logic.

Any idea how I could fix this query?
Thanks in advance

Since Retool uses a Postgres DB, you'll need to use something more like:

SELECT *
FROM contract
WHERE 
  end_date < getdate() + INTERVAL '3 months'

Hey @pyrrho,

Thaks for you help

Just tried again this syntax as well and got:

function getdate() does not exist

I sepcifically looked for PSQL syntax but without result so far

Ah, right, I think it might be CURRENT_DATE:

image

1 Like

CURRENT_DATE works nicely thanks @pyrrho :pray:

2 Likes