SELECT DISTINCT B.USERID , B.OPRDEFNDESC ,A.AP_MTCH_EXCP_GRP FROM PS_AP_MTCH_GRP_USR A , PS_AP_MEC_OPRDF_VW B , PS_AP_MEC_GRACT_VW C WHERE A.OPRID = B.USERID AND A.AP_MTCH_EXCP_GRP = C.AP_MTCH_EXCP_GRP UNION SELECT DISTINCT ROL.ROLEUSER , B.OPRDEFNDESC ,A.AP_MTCH_EXCP_GRP FROM PS_AP_MTCH_GRP_ROL A , PS_AP_MEC_OPRDF_VW B , PS_AP_MEC_GRACT_VW C , PSROLEUSER ROL WHERE ROL.ROLEUSER = B.USERID AND A.AP_MTCH_EXCP_GRP = C.AP_MTCH_EXCP_GRP AND A.ROLENAME = ROL.ROLENAME AND NOT EXISTS (SELECT 'X' FROM PS_AP_MTCH_GRPEXCL EXCL WHERE EXCL.AP_MTCH_EXCP_GRP = A.AP_MTCH_EXCP_GRP AND EXCL.OPRID = B.USERID)
|