mercredi 4 mars 2015

Help converting a MySQL query to postgres


Is it possible to do this query in postgresql?



SET @p:= 0;
UPDATE t SET x=CEIL((@p:= @p + 1) / $n) ORDER BY id DESC;


I'm struggling with the variable syntax. I tried:



\set p 0
update t set x=CEIL((:p := :p+1) / 10);
ERROR: syntax error at or near ":="
LINE 1: update t set x=CEIL((0 := 0+1) / 10);




Aucun commentaire:

Enregistrer un commentaire