This query which works with mySQL doesn't work with Postgresql:
select ... from ... where (id = ... and ( h > date_sub(now(), INTERVAL 30 MINUTE)))
The error is:
Query failed: ERREUR: erreur de syntaxe sur ou près de « 30 »
Any ideas ?
DATE_SUB
is a MySQL function that does not exist in PostgreSQL.
You can (for example) either use;
NOW() - '30 MINUTES'::INTERVAL
...or...
NOW() - INTERVAL '30' MINUTE
...or...
NOW() - INTERVAL '30 MINUTES'
as a replacement.
An SQLfiddle with all 3 to test with.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With