日期:2014-05-17  浏览次数:20717 次

求大神帮忙写个SQL语句啊 急用 谢谢

表名叫T_MH_TARGET_SUM 根据year,month,把month为11的sum_ndmb的值赋给相同sum_object_id,month为12的

------解决方案--------------------
meger into T_MH_TARGET_SUM t2 using(select * from T_MH_TARGET_SUM  where t.month=11) t1 on (t1.sum_object_id=t2.sum_object_id and t2.month=12)
when matched then
update t2 set t2.sum_ndmb=t1.sum_ndmb;

------解决方案--------------------
merge into