sqlserver 从titles表中title字段查询的结果,如果有Computers单词用***替换,Cooking单词用###替换?

图片说明

sqlserver数据库的字符串函数知识,谢谢大佬帮忙!

replace 函数

可以用两个replace实现,见下面代码:

SELECT REPLACE(title,'Cooking','###') from (
SELECT REPLACE(title,'Computers','***') as title from titles) t;

select replace(replace(title,'Computers','***'),'Cooking','###') from titles