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

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -