How to request relative date (ie, CURRENT_DATE - 30) #2947
-
I have a table with a column where I would like to get the results that are older than the past 30 days. I've been looking at the timestamp documentation but I can't understand how to do this. I am beginning to assume my best solution is going to be to create a view, but I want to be sure I am not missing something. So in
In But with Not sure if I am doing something wrong here, or perhaps missing a syntax quirk? Much less how to replicate the Happy to provide more context bu not sure what is helpful. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
PostgreSQL has two different "now"s:
There is no such special input value for timestamptz or date for "current_date". That's the error message you are seeing. Also see the PG docs in 8.5.1.4. Special Values:
As for a solution, imho you have several ways to do this:
|
Beta Was this translation helpful? Give feedback.
PostgreSQL has two different "now"s:
now()
, which returns the same asCURRENT_TIMESTAMP
. This is the similar toCURRENT_DATE
. You seem to assume you are calling this withlt.now
, but you are not.lt.now
.There is no such special input value for timestamptz or date for "current_date". That's the error message you are seeing.
Also see the PG docs in 8.5.1.4. Special Values: