批量更新

1.把一个表的内容批量更新到另一张表中,如把user_info_tmp的LASTYEAR_SUMPLAYDAY字段的值更新到user_info表中

update user_info u set u.LASTYEAR_SUMPLAYDAY =

(

 select ut.LASTYEAR_SUMPLAYDAY from user_info_tmp ut

 where ut.user_id = u.user_id

)

where exists(

select ut.LASTYEAR_SUMPLAYDAY from user_info_tmp ut

 where ut.user_id = u.user_id

);

猜你喜欢

转载自577439237.iteye.com/blog/2275842