how to update a record in the table using PostgreSQL?
I have one table it contains the record .The below is the sample.
$40608$<12988>
What we need ?
I need to update the record where it presents in the table using the value "12988" and again update the value("12988") to 12989.
I have tried to search the record in postgresql using the LIKE '%<129开发者_高级运维88>%'
i need to update the value ($40608$<12988>)
testbed:
create table t(val text);
insert into t(val) values ('$40608$<12988>');
select * from t;
val
----------------
$40608$<12988>
(1 row)
update:
update t
set val=replace(val, '<12988>', '<12989>')
where val like '%<12988>';
result:
select * from t;
val
----------------
$40608$<12989>
(1 row)
精彩评论