对于表中的所有字符串s1,将所有子字符串s2更改为子字符串s3

时间:2019-05-05 13:11:14

标签: postgresql

有一个表if str(context.activity.value) != 'None': response = context.activity.value #json ex:{'value':'hello'} # if i do, prompt_message = await create_reply_activity(context.activity, respone.get('value')) # bot will say what user typed. but i want to make it from client side like what i could see in # contososcubademo.azurewebsites.net prompt_message = await create_reply_activity(context.activity, answer) gen_result=await oneday_hanlde.Input_generator(response,state.Flow) answer= gen_result[0] #text ex: 'hi there!' prompt_message = await create_reply_activity(context.activity, answer) 。如何编写一个返回表t1(id int, string1 varchar(15), string2 varchar(15), string3 varchar(15))的请求,其中res1是s1,其中子字符串s2的所有条目都变为子字符串s3?

例如,如果t1包含2个字符串: (id int, res1 varchar(200))结果应为表格 (0, 'catcat', 'cat', 'dog') (1, 'dddod', 'd', 'a')

1 个答案:

答案 0 :(得分:0)

可能正在使用简单的replace

select id, replace(string1,string2,string3) from t1;

DEMO