SELECT A.BO_ID_2 , A.BO_ID_1 , E.PROFILE_CM_SEQ , D.PHONE , D.CM_CONCAT FROM PS_BO_REL A , PS_BO_REL_CAT_ITEM B , PS_BO_CM C , PS_CM D , PS_BO_ABE_DTL E WHERE B.BO_REL_CATEGORY_ID = 1 AND A.REL_TYPE_ID = B.REL_TYPE_ID AND A.START_DT <= %CurrentDateIn AND A.END_DT > %CurrentDateIn AND A.BO_ID_1 = C.BO_ID AND A.BO_ID_1 = E.BO_ID AND C.CM_ID = D.CM_ID AND C.BO_CM_START_DT <= %CurrentDateIn AND C.BO_CM_END_DT > %CurrentDateIn AND C.PROFILE_CM_SEQ = E.PROFILE_CM_SEQ AND C.PROFILE_CM_SEQ = ( SELECT MIN(F.PROFILE_CM_SEQ) FROM PS_BO_ROLECM_PHON F WHERE F.BO_ID = C.BO_ID AND F.BO_CM_START_DT <= %CurrentDateIn AND F.BO_CM_END_DT > %CurrentDateIn AND F.CM_USE_START_DT <= %CurrentDateIn AND F.CM_USE_END_DT > %CurrentDateIn AND F.PRIMARY_IND = 'Y' AND F.ROLE_TYPE_ID = 8)
|