Professional Documents
Culture Documents
Foyrth Pres
Foyrth Pres
x integer,
y integer
Which gives:
x |y
----+---
1|
2|
3|
4|
5|
6|
7|
8|
9|
10 |
(10 rows)
I'd like to have something like (note - I do not care about the ordering of the three values updated in y
here):
x |y
----+---
1| 1
2| 2
3| 3
4|
5|
6|
7|
8|
9|
10 |
(10 rows)
UPDATE tbl
SET y = x
WHERE y IS NULL
LIMIT 3;
But I get the error ERROR: syntax error at or near "LIMIT", which I'm not sure how to fix.
Solution
update tbl
set y = x
I can't think of a scenario this would fail, if there's a better approach it'd be good to know.
postgresqlupdatelimits