当前位置: 代码迷 >> 其他数据库 >> mysql中怎么用查询出来的数据更新另外一个表数据
  详细解决方案

mysql中怎么用查询出来的数据更新另外一个表数据

热度:8917   发布时间:2013-02-26 00:00:00.0
mysql中如何用查询出来的数据更新另外一个表数据
我在Oracle中的语句是这样的

update table1 a set(a1,a2,a3,a4) = (select b1,b2,b3,b4 from table2 b where b.id = a.unit_id) where a.enabled_flag='Y'

直接拿到mysql中执行时报错了,就报set的等号这里的语法错误?
这里mysql不是这样写的吗?
mysql中应该怎么写?

------解决方案--------------------------------------------------------
SQL code
update table1 a , table2 bset a1=b1,a2=b2,a3=b3,a4=b4where b.id = a.unit_idand a.enabled_flag='Y'
  相关解决方案