SELECT DISTINCT A.BO_ID_CONTACT , D.ROLE_TYPE_ID_CNTCT , A.BUSINESS_UNIT FROM PS_RSF_LEAD A , PS_RSF_LE_CONTACTS D WHERE A.BO_ID_CONTACT > 0 AND A.BO_ID_CONTACT = D.BO_ID_CONTACT AND ( EXISTS ( SELECT A.BO_ID_CONTACT FROM PS_RSF_LE_CONTACTS B WHERE A.BO_ID_CONTACT = B.BO_ID_CONTACT) OR EXISTS ( SELECT BO_ID_CONTACT FROM PS_RSF_OPP_CONTACT C WHERE A.BO_ID_CONTACT = C.BO_ID_CONTACT) OR EXISTS ( SELECT BO_ID_CONTACT FROM PS_RSF_OPPORTUNITY E WHERE A.BO_ID_CONTACT = E.BO_ID_CONTACT)) GROUP BY A.BO_ID_CONTACT, D.ROLE_TYPE_ID_CNTCT, A.BUSINESS_UNIT
|