简体   繁体   English

带有 JOIN 的 SQL UPDATE 查询

[英]SQL UPDATE query with JOIN

I already search and real all previous questions & answers about it but i just can't find the good way to do what i want, so maybe my problem can also help other people, let see.我已经搜索并真实地搜索了所有以前的问题和答案,但我找不到做我想做的事情的好方法,所以也许我的问题也可以帮助其他人,让我们看看。

I'm trying to use this SQL query :我正在尝试使用此 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

to replace a string in ps_product_lang table, column description替换ps_product_lang表中的字符串,列描述

The WHERE clause have to match an ID from ps_product table (column id_category_default ) WHERE 子句必须匹配来自ps_product表(列id_category_default )的 ID

What is wrong here?这里有什么问题?

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM