I have one query, made it in MySQL.
And now try to run on PostgreSQL, but get syntax error twice.
Once on the DIV command, and then on the GROUP BY.
Here is my code:
UPDATE status_table
SET Status_CG = true
WHERE EXISTS ( SELECT MAX(m2.t1 - m1.t1) as difference
FROM measurements AS m1
INNER JOIN measurements AS m2
ON `m2`.`Measurements_ID`
> m1.Measurements_ID
AND (m2.Measurements_ID -1) DIV 10
= ( m1.Measurements_ID - 1) DIV 10
GROUP BY (m1.Measurements_ID - 1 ) DIV 10
HAVING MAX(m2.t1 - m1.t1) >= 100
);
DIV
predicate can be converted as postgresql/
operator/
for division and so does Postgres. Those dreaded backticks are also invalid standard SQL and invalid in Postgres. Use double quotes"
instead.