批量修改的SQL



-----------------------------------------------------------------------------------------
本次需要执行的SQL

  select a.agentcode,b.agentcode,a.idno,b.idno,a.makedate from laagent a ,laagentb b where a.agentcode=b.agentcode and a.branchtype ='1' order by a.agentcode
  select a.agentcode,b.agentcode,a.age,b.age,a.makedate from laagent a ,laagentb b where a.agentcode=b.agentcode  and a.branchtype ='1' order by a.agentcode
  select a.agentcode,b.agentcode,a.joindate,b.joindate,a.makedate from laagent a ,laagentb b where a.agentcode=b.agentcode  and a.branchtype ='1' order by a.agentcode
  select a.agentcode,b.agentcode,a.RecommendAgent,b.RecommendAgent,a.makedate from laagent a ,laagentb b where a.agentcode=b.agentcode  and a.branchtype ='1' order by a.agentcode

例子:  

     update laagent z set z.idno =( select b.idno from laagentb b where b.agentcode=z.agentcode
      and b.idno is not null and b.branchtype='1'
      and edorno =(select max(edorno) from laagentb c where b.agentcode=c.agentcode and c.idno is not null))
     where z.idno is null
      and z.branchtype = '1'


     update laagent z set z.age =( select b.age from laagentb b where b.agentcode=z.agentcode
      and b.age!=0 and b.branchtype='1'
      and edorno =(select max(edorno) from laagentb c where b.agentcode=c.agentcode and c.age!=0))
     where z.age=0
      and z.branchtype = '1'


     update laagent z set z.recommendagent =( select b.recommendagent from laagentb b where b.agentcode=z.agentcode
      and b.recommendagent is not null and b.branchtype='1'
      and edorno =(select max(edorno) from laagentb c where b.agentcode=c.agentcode and c.recommendagent is not null))
     where z.recommendagent is null
      and z.branchtype = '1'


     update laagent z set z.joindate =( select b.joindate from laagentb b where b.agentcode=z.agentcode
      and b.joindate is not null and b.branchtype='1'
      and edorno =(select max(edorno) from laagentb c where b.agentcode=c.agentcode and c.joindate is not null))
     where z.joindate is null
      and z.branchtype = '1'

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值