初始化数据库
CREATE TABLE public.t1
(
name text
)
name
-------
"David"
"Peter"
"任务2016-09-10 10:09:00"
"任务2016-10-10 12:03:00"
"任务2016-12-22 14:10:00"
把包含"任务"的记录替换为"Job"
update t1 set name= ‘Job‘||substring(name,3) where substring(name,position(‘任务‘ in name),2)=‘任务‘;
select * from t1;
name
-------
"David"
"Peter"
"Job2016-09-10 10:09:00"
"Job2016-10-10 12:03:00"
"Job2016-12-22 14:10:00"
本文出自 “yiyi” 博客,请务必保留此出处http://heyiyi.blog.51cto.com/205455/1885075
原文地址:http://heyiyi.blog.51cto.com/205455/1885075