(1).update tableName set (a,b,c)=(select a,b,c from ida where ida.id=tableName.id);
(2).update tableName t1 set a=(select t2.a from ida t2 where t1.id=t2.id),b=(select t2.b from ida t2 where t1.id=t2.id),c=(select t2.c from ida t2 where t1.id=t2.id)
(3) 每条数据执行为:UPDATEtableName SET (A,B,C)=(select A,B,C from
tableName where id=''xxxxxx) WHERE id='xxxxxxx'

本文介绍了三种使用SQL进行数据更新的方法,包括直接更新表字段值及通过子查询更新的方式。这些技巧适用于需要从另一个表中获取数据并更新当前表的情况。
6795

被折叠的 条评论
为什么被折叠?



