Syntax error while comparing timestamps in PostgreSQL -
error: "syntax error @ or near interval"
join in question:
... left outer join usersession e on a.userid = e.userid , e.lastaction >= now() interval '-4h' * 1"
lastaction
created lastaction timestamp null default null
the idea is, return nils if session's timestamp 4 hours older current time.
no idea deal here, never had compare timestamps before either.
if want records last 4 hours need:
now() - interval '4 hours'
instead of
now() interval '-4h' * 1
Comments
Post a Comment