日期:2014-05-16 浏览次数:21088 次
insert into e_rel_customer( CUSTOM_ID ,REL_CUSTOM_ID ,REL_ID ,CUSTOM_NAME ,idtype_id ) SELECT T1.MFCUSTOMERID AS CUSTOMERID, T2.MFCUSTOMERID AS RELATIVEID, RELATIONSHIP, CUSTOMERNAME, CERTTYPE FROM XD_CUSTOMER_RELATIVE, LEFT JOIN (SELECT NVL(MAX(MFCUSTOMERID), '') MFCUSTOMERID, CUSTOMERID FROM SOR_XD_CUSTOMER_INFO WHERE MFCUSTOMERID IS NOT NULL GROUP BY CUSTOMERID) T1 ON T1.CUSTOMERID = XD_CUSTOMER_RELATIVE.CUSTOMERID LEFT JOIN (SELECT NVL(MAX(MFCUSTOMERID), '') MFCUSTOMERID, CUSTOMERID FROM SOR_XD_CUSTOMER_INFO WHERE MFCUSTOMERID IS NOT NULL GROUP BY CUSTOMERID) T2 ON T2.CUSTOMERID = XD_CUSTOMER_RELATIVE.RELATIVEID