https://meilishiyan-song.taobao.com/

201

insert into master_ter values ('K25080117094','1702865',NULL) ;
insert into master_ter values ('K25080117226','1702865',NULL) ;
insert into master_ter values ('K25080117236','1702865',NULL) ;
insert into master_ter values ('K25080117413','1702865',NULL) ;
insert into master_ter values ('K25080117411','1702865',NULL) ;
insert into master_ter values ('K25080117410','1702865',NULL) ;
insert into master_ter values ('K25080117412','1702865',NULL) ;
insert into master_ter values ('K25080117408','1702865',NULL) ;
insert into master_ter values ('K25080117660','1702865',NULL) ;
insert into master_ter values ('K25080117667','1702865',NULL) ;
insert into master_ter values ('K25080117659','1702865',NULL) ;
insert into master_ter values ('K25080117666','1702865',NULL) ;
insert into master_ter values ('K25080117657','1702865',NULL) ;
insert into master_ter values ('K25080116419','1702865',NULL) ;
insert into master_ter values ('K25080600269','1702865',NULL) ;
insert into master_ter values ('K25080600271','1702865',NULL) ;
insert into master_ter values ('K25080600270','1702865',NULL) ;
insert into master_ter values ('K25080600463','1702865',NULL) ;
insert into master_ter values ('K25080107997','1702865',NULL) ;
insert into master_ter values ('K25080108000','1702865',NULL) ;
insert into master_ter values ('K25080108001','1702865',NULL) ;
insert into master_ter values ('K25080107351','1702865',NULL) ;
insert into master_ter values ('K25080114640','1702865',NULL) ;
insert into master_ter values ('K25080114641','1702865',NULL) ;
insert into master_ter values ('K25080900002','1702865',NULL) ;
insert into master_ter values ('K25080101137','1702865',NULL) ;
insert into master_ter values ('K25080107754','1702865',NULL) ;
insert into master_ter values ('K16210110110604','1702865',NULL) ;
insert into master_ter values ('K16210110110605','1702865',NULL) ;
insert into master_ter values ('K25080600502','1702865',NULL) ;
insert into master_ter values ('K25080600504','1702865',NULL) ;
insert into master_ter values ('K25080600499','1702865',NULL) ;
insert into master_ter values ('K25080600497','1702865',NULL) ;
insert into master_ter values ('K25080600498','1702865',NULL) ;
insert into master_ter values ('K25080600501','1702865',NULL) ;
insert into master_ter values ('K25080600505','1702865',NULL) ;
insert into master_ter values ('K25080600500','1702865',NULL) ;
insert into master_ter values ('K25080600503','1702865',NULL) ;
insert into master_ter values ('K25081400176','1702865',NULL) ;
insert into master_ter values ('K25080103737','1702865',NULL) ;
insert into master_ter values ('K25080109568','1702865',NULL) ;
insert into master_ter values ('K25080107729','1702865',NULL) ;
insert into master_ter values ('K25080101057','1702865',NULL) ;
insert into master_ter values ('K25080107731','1702865',NULL) ;
insert into master_ter values ('K25080109195','1702865',NULL) ;
insert into master_ter values ('K25080900238','1702865',NULL) ;
insert into master_ter values ('K25080900242','1702865',NULL) ;
insert into master_ter values ('K25080900234','1702865',NULL) ;
insert into master_ter values ('K25080900230','1702865',NULL) ;
insert into master_ter values ('K25080900235','1702865',NULL) ;
insert into master_ter values ('K25080900237','1702865',NULL) ;
insert into master_ter values ('K25080900233','1702865',NULL) ;
insert into master_ter values ('K25080900232','1702865',NULL) ;
insert into master_ter values ('K25080900239','1702865',NULL) ;
insert into master_ter values ('K25080900240','1702865',NULL) ;
insert into master_ter values ('K25080121264','1702865',NULL) ;

 

UPDATE m SET m.REC_TIME_STAMP=GETDATE(),m.Unit=NULL,

m.DSS=s.code,m.sel_ter_id=s.id,m.Dealer_Code=s.customer_code,

m.Sharp_ID=s.sharp_id,m.Customer_Person=s.employee_name_cn

 FROM Master_Store m,

(SELECT o.code,o.customer_code,t.id,mt.atom_code,

s.sharp_id,s.employee_name_cn FROM master_ter mt join Territory t on mt.ser_ter_id = t.ter_name join ORGANIZATION o

on t.org_id=o.id  and type =4 left join SYS_USER s on t.sharp_id=s.sharp_id) s

 where m.ATOM_CODE=s.atom_code

 

UPDATE m SET m.REC_TIME_STAMP=GETDATE(),m.Unit=s.code,m.DSS=NULL,

m.sel_ter_id=s.id,m.Sharp_ID=s.sharp_id,m.Customer_Person=s.employee_name_cn

FROM Master_Store m,

(SELECT o.code,o.customer_code,t.id,mt.atom_code,

s.sharp_id,s.employee_name_cn FROM master_ter mt join Territory t on mt.ser_ter_id = t.ter_name join ORGANIZATION o

on t.org_id=o.id and type =1 left join SYS_USER s on t.sharp_id=s.sharp_id ) s

 where m.ATOM_CODE=s.atom_code

posted @ 2017-08-14 15:52  望梦圆  阅读(162)  评论(0编辑  收藏  举报
https://meilishiyan-song.taobao.com/