-----------------------------------------------------------------------------------------
本次需要执行的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'