I have a table with the Integet column as a Primary key. For testing purpose, I want to restore the table to a test server and randomly change the ID column.
Something like
select ('9985'||id)::int from table;
But updating is not working as I expected.
update test set id=(select ('9985'||id)::int from test);
ERROR:
ERROR: more than one row returned by a subquery used as an expression
What about:
update test set id = ('9985'||id)::int
You don't need the from part
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.