update productprice
set enddate = ’2016-12-31 00:00:00’
from product inner join
productprice
on product.id = productprice.id
where product.code = ‘9301940252’
但结果是"表名“productprice”多次指定"
我在这里做错了什么?感谢。
答案 0 :(得分:5)
这是MySQL的正确语法:
update productprice pp join
product p
on p.id = pp.id
set pp.enddate = '2016-12-31'
where p.code = '9301940252';
鉴于您的错误以及该问题最初将Postgres和MySQL作为标记这一事实,您可能希望使用Postgres语法:
update productprice pp
set enddate = '2016-12-31'
from product p
where p.id = pp.id and p.code = '9301940252';