我有两个数据库-RATINGSAPP和MIGRATIONDATA。
我想使用MIGRATIONDATA中的表中的某些值更新RATINGSAPP中的表。我正在尝试运行此查询:
update r set internal_id = m.internal_id from ratingsapp.hotel03 as r
inner join migrationdata.migration as m on r.hotel_id = m.restaurant_id
这给了我错误:
You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right syntax to use near
'from ratingsapp.hotel03 as r inner join migrationdata.migration as m on r.hotel_' at line 1
但是,类似的选择查询对我有用,并给出正确的结果。
select r.hotel_id, m.internal_id from ratingsapp.hotel03 as r
inner join migrationdata.migration as m on r.hotel_id = m.restaurant_id
我在更新查询中做错了什么?
正确的MySQL语法是:
update ratingsapp.hotel03 r inner join
migrationdata.migration as m
on r.hotel_id = m.restaurant_id
set internal_id = m.internal_id ;
from
MySQL更新中没有子句。您正在使用SQL Server / Postgres语法。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句