SELECT TOP 10000 [id]
,[a]
,[b]
,[c]
,[d]
,[e],
replace([e],'href=www.test.com/','href=') aaa
,[f]
,[g]
,[h]
,[i]
,[j]
,[k]
,[l]
,[m]
from test_table
where --e like '%href=www.test.com/%'
m='system' and create_time>'20220513' and create_time<'20220514'
替换:
update test
set url = replace(url, 'www.test.com', 'www.test.com/abc')
where id = 1;
最终的:www.test.com/abc/原来的字符串
本文介绍了如何使用SQL进行复杂查询,包括从test_table中选取特定数据并进行字符串替换操作。示例展示了一条SELECT语句,用于获取指定条件下的多列数据,并用replace函数修改'e'列的值。此外,还演示了一个UPDATE语句,用于更新url字段,将'www.test.com'替换为'www.test.com/abc',确保url以'/abc/'结尾。
760

被折叠的 条评论
为什么被折叠?



