问题
I am trying to save some manual time by search and replacing in my PostgreSQL database.
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
Would this be correct syntax?
回答1:
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'
来源:https://stackoverflow.com/questions/59040712/postgresql-search-and-replace-where-condition