用PL/SQL写
现有表1和表2
表1,表2原本都有数据.
要求:把表1中C_DAIMA的数据更新到表2的C_DM里
条件是表1的C_ID要等于表2的C_AID
update t_table2
set c_dm
from t_table1 inner join t_table2 on t_table1.c_id = t_table2.c_aid我用过以上这种方法,不过显示错误,说SQL语句错误,C_DAIMA和C_DM的数据类型是一样的
请问应该怎么改?有什么更好的方法?
现有表1和表2
表1,表2原本都有数据.
要求:把表1中C_DAIMA的数据更新到表2的C_DM里
条件是表1的C_ID要等于表2的C_AID
update t_table2
set c_dm
from t_table1 inner join t_table2 on t_table1.c_id = t_table2.c_aid我用过以上这种方法,不过显示错误,说SQL语句错误,C_DAIMA和C_DM的数据类型是一样的
请问应该怎么改?有什么更好的方法?
补充楼上一下update t_table2 set c_dm=(select c_daima from t_table1 where t_table1.c_id = t_table2.c_aid) where exists(select 1 from t_table1 where t_table1.c_id = t_table2.c_aid);