PostgreSQL搜索并替换条件 [英] PostgreSQL search and replace where condition
本文介绍了PostgreSQL搜索并替换条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试通过搜索和替换PostgreSQL数据库来节省一些手动时间。
I am trying to save some manual time by search and replacing in my PostgreSQL database.
我有一个名为 Products_Colors $的表c $ c>我要替换列
color_image
中的所有文本,其中列 color_id
等于21。
I have a table called Products_Colors
where i'd like to replace all text in column color_image
where column color_id
is equal to 21.
UPDATE
Product_Colors
SET
color_image = REPLACE(color_image,"cars/car_2018.webp","cars/car_2019.webp")
WHERE
color_id = 21
这是正确的语法吗?
推荐答案
我认为您需要这样的查询:
I think you need a query like this :
UPDATE Product_Colors
SET color_image = 'cars/car_2019.webp'
WHERE color_id = 21 and color_image = 'cars/car_2019.webp'
这篇关于PostgreSQL搜索并替换条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文