用户同步的sql:
insert into crm_customer_user select null,1505,username,'9ZZY9rJx8+6ITe5AWVe+dg==',null,null,name,1,101,0,-1,id,0 from sys_user where username not in (select user_name from crm_customer_user); -- select count(1) from sys_user where username not in (select user_name from crm_customer_user); UPDATE crm_customer_user SET crm_customer_user.EUSERID= (select id from (SELECT login_name, id FROM euser@LINK_CFD1 WHERE login_name IN (SELECT username FROM sys_user) and login_name not in ('lid','wuj')-- 这两个用户名在原表中是重复的 )eu where crm_customer_user.user_name=eu.login_name ) WHERE crm_customer_user.EUSERID=-1;
这种:
UPDATE ATT_VEHICLEDISPATCH AV SET AV.MAX_GROSS= ( SELECT EU.WEIGHTLIMIT FROM ( SELECT TC.carsign, CAR.WEIGHTLIMIT FROM T_CARDINFO TC JOIN CAR_WEIGHTLIMIT CAR ON TC.AXLETYPE=car.AXLETYPE WHERE 1 =1 AND cardstatus=1 AND CARDTYPE =1 )EU WHERE AV.CARNO=EU.carsign ) WHERE AV.max_gross is null and AV.handletime>to_date('2017-04-25 11:00','yyyy-mm-dd hh24:mi');