SELECT DISTINCT A.VENDOR_SETID , A.VENDOR_ID , A.VNDR_LOC FROM PS_EM_AGREEMENT A WHERE (EXISTS ( SELECT 'X' FROM PS_EM_L_NOTIFY B WHERE A.VENDOR_SETID = B.SETID AND A.VENDOR_ID = B.VENDOR_ID AND A.VNDR_LOC = B.VNDR_LOC AND B.NOTIFY_FLAG = 'Y' AND B.EM_NOTIFY_TYPE = '18')) OR ((EXISTS ( SELECT 'X' FROM PS_EM_S_NOTIFY C WHERE A.VENDOR_SETID = C.SETID AND C.NOTIFY_FLAG = 'Y' AND C.EM_NOTIFY_TYPE = '18')) AND (NOT EXISTS ( SELECT 'X' FROM PS_EM_L_NOTIFY D WHERE A.VENDOR_SETID = D.SETID AND A.VENDOR_ID = D.VENDOR_ID AND A.VNDR_LOC = D.VNDR_LOC AND D.EM_NOTIFY_TYPE = '18')))
|