update un u
set u.reserve = 0, u.cnt = u.cnt + u.share,u.modified=sysdate
where exists ( select 'X'
from tb t, un u
where t.type_id = 21
and t.order_id = u.united_id
and t.status = 8 );
set u.reserve = 0, u.cnt = u.cnt + u.share,u.modified=sysdate
where exists ( select 'X'
from tb t, un u
where t.type_id = 21
and t.order_id = u.united_id
and t.status = 8 );
本文介绍如何使用SQL更新语句对特定条件下的表数据进行批量修改,具体实例为更新未使用的表tu中reserve字段为0,并累加cnt和share字段的值,同时更新修改时间。
3019

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



