我有一张表,里面有记录。下面是样品。

 $40608$<12988>

我们需要什么?
我需要使用值“12988”更新表中显示的记录
再次将值(“12988”)更新为12989。
我试图使用LIKE '%<12988>%'在postgresql中搜索记录
我需要更新值($40608$)

最佳答案

试验台:

create table t(val text);
insert into t(val) values ('$40608$<12988>');

select * from t;
      val
----------------
 $40608$<12988>
(1 row)

更新:
update t
set val=replace(val, '<12988>', '<12989>')
where val like '%<12988>';

结果:
select * from t;
      val
----------------
 $40608$<12989>
(1 row)

09-10 21:29
查看更多