使用JOIN进行SQL UPDATE查询

时间:2016-05-01 22:46:35

标签: mysql sql prestashop

我已经搜索过所有以前的所有问题&关于它的答案,但我无法找到做我想要的好方法,所以也许我的问题也可以帮助其他人,让我们看看。

我尝试使用此SQL查询:

UPDATE L

   SET L.description = REPLACE(L.description, '196,99', '197') 

  FROM ps_product_lang AS L 
  JOIN ps_product AS P 
    ON L.id_product = P.id_product



 WHERE P.id_category_default = 23

替换 ps_product_lang 表中的字符串,列 description

WHERE子句必须匹配 ps_product 表中的ID(列 id_category_default

这里有什么问题?

1 个答案:

答案 0 :(得分:1)

UPDATE ps_product_lang AS L 

  JOIN ps_product AS P 
    ON L.id_product = P.id_product

   SET L.description = REPLACE(L.description, '196,99', '197') 

 WHERE P.id_category_default = 23
相关问题