update table1 set 一月=(select 一月-sum(变更数量) from table2 where 变更年月>'200801' and 类型||'合计'=table1.类型),
二月=(select 二月-sum(变更数量) from table2 where 变更年月>'200802' and 类型||'合计'=table1.类型),
..........
以此类推,逐月更新,月份太多的话可以写个小循环
二月=(select 二月-sum(变更数量) from table2 where 变更年月>'200802' and 类型||'合计'=table1.类型),
..........
以此类推,逐月更新,月份太多的话可以写个小循环
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货