oracle批量更新

update t_tjxx t set t.bndkcount =(select tmp2.count from (select count(1) as count,g.organcode as organcode from meeting_main g where TO_CHAR(g.BEGINTIME, 'yyyy') = TO_CHAR(SYSDATE, 'yyyy') AND g.TYPEID = 4 group by g.organcode) tmp2 where t.organcode = tmp2.organcode) where exists (select tmp2.count from (select count(1) as count,g.organcode as organcode from meeting_main g where TO_CHAR(g.BEGINTIME, 'yyyy') = TO_CHAR(SYSDATE, 'yyyy') AND g.TYPEID = 4 group by g.organcode) tmp2 where t.organcode = tmp2.organcode);commit;

update t_tjxx t
   set t.bndkcount =(select tmp2.count from 
       (select count(1) as count,g.organcode as organcode
          from meeting_main g
         where TO_CHAR(g.BEGINTIME, 'yyyy') = TO_CHAR(SYSDATE, 'yyyy')
           AND g.TYPEID = 4
            group by g.organcode) tmp2  where t.organcode = tmp2.organcode)
 where exists
 (select tmp2.count from 
       (select count(1) as count,g.organcode as organcode
          from meeting_main g
         where TO_CHAR(g.BEGINTIME, 'yyyy') = TO_CHAR(SYSDATE, 'yyyy')
           AND g.TYPEID = 4
            group by g.organcode) tmp2  where t.organcode = tmp2.organcode);
commit;



 update t_tjxx xx
    set xx.bjdydhcount =
        (select tmp2.count
           from (SELECT COUNT(G.UUID) AS COUNT, g.organcode as organcode
                   FROM MEETING_MAIN G
                  WHERE G.TYPEID = 1
                    and TO_CHAR(G.BEGINTIME, 'Q') = to_char(SYSDATE, 'Q')
                  group by g.organcode) tmp2
          where xx.organcode = tmp2.organcode)
  where exists
  (select tmp2.count
           from (SELECT COUNT(G.UUID) AS COUNT, g.organcode as organcode
                   FROM MEETING_MAIN G
                  WHERE G.TYPEID = 1
                    and TO_CHAR(G.BEGINTIME, 'Q') = to_char(SYSDATE, 'Q')
                  group by g.organcode) tmp2
          where xx.organcode = tmp2.organcode);
  commit;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值