Mysql SQL查询-具有内部联接的不同数据库
我有两个DBs-RATINGSAPP和MIGRATIONDATA 我想用MIGRATIONDATA表中的一些值更新RATINGSAPP中的表。我正在尝试运行此查询:Mysql SQL查询-具有内部联接的不同数据库,mysql,Mysql,我有两个DBs-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 ha
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查询对我来说很有效,并给出了正确的结果
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 ;
MySQL更新中没有from子句。您正在使用SQL Server/Postgres语法