I am using Datagrip for Postgresql. I have a table with a date field in timestamp format (ex: 2016-11-01 00:00:00)
. I want to be able to:
- apply a mathematical operator to subtract 1 day
- filter it based on a time window of today-130 days
- display it without the hh/mm/ss part of the stamp (2016-10-31)
Current starting query:
select org_id, count(accounts) as count, ((date_at) - 1) as dateat
from sourcetable
where date_at <= now() - 130
group by org_id, dateat
The ((date_at)-1)
clause on line 1 results in:
[42883] ERROR: operator does not exist: timestamp without time zone - integer Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts. Position: 69
The now()
clause spawns a similar message:
[42883] ERROR: operator does not exist: timestamp with time zone - integer Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts. Position: ...
Online guides to type casts are singularly unhelpful. Input is appreciated.