SELECT A.SETID , A.VENDOR_ID , A.VNDR_LOC , B.LANGUAGE_CD , B.DESCR , V.NAME1 FROM PS_VENDOR_LOC A , PS_VNDRLOCSCROL_LG B , PS_VENDOR_LANG V WHERE A.EFF_STATUS = 'A' AND A.EFFDT = ( SELECT MAX(I.EFFDT) FROM PS_VENDOR_LOC I WHERE I.SETID = A.SETID AND I.VENDOR_ID = A.VENDOR_ID AND I.VNDR_LOC = A.VNDR_LOC AND I.EFFDT <= %CurrentDateIn) AND B.SETID = A.SETID AND B.VENDOR_ID = A.VENDOR_ID AND B.VNDR_LOC = A.VNDR_LOC AND A.SETID = V.SETID AND A.VENDOR_ID = V.VENDOR_ID AND B.LANGUAGE_CD = V.LANGUAGE_CD UNION SELECT A.SETID , A.VENDOR_ID , A.VNDR_LOC , B.LANGUAGE_CD , B.DESCR , V.NAME1 FROM PS_VENDOR_LOC A , PS_VNDRLOCSCROL_LG B , PS_VENDOR V WHERE A.EFF_STATUS = 'A' AND A.EFFDT = ( SELECT MAX(I.EFFDT) FROM PS_VENDOR_LOC I WHERE I.SETID = A.SETID AND I.VENDOR_ID = A.VENDOR_ID AND I.VNDR_LOC = A.VNDR_LOC AND I.EFFDT <= %CurrentDateIn) AND B.SETID = A.SETID AND B.VENDOR_ID = A.VENDOR_ID AND B.VNDR_LOC = A.VNDR_LOC AND A.SETID = V.SETID AND A.VENDOR_ID = V.VENDOR_ID AND NOT EXISTS ( SELECT 1 FROM PS_VENDOR_LANG WHERE SETID=A.SETID AND VENDOR_ID=A.VENDOR_ID AND LANGUAGE_CD=B.LANGUAGE_CD ) UNION SELECT A.SETID , A.VENDOR_ID , A.VNDR_LOC , V.LANGUAGE_CD , B.DESCR , V.NAME1 FROM PS_VENDOR_LOC A , PS_VNDR_LOC_SCROL B , PS_VENDOR_LANG V WHERE A.EFF_STATUS = 'A' AND A.EFFDT = ( SELECT MAX(I.EFFDT) FROM PS_VENDOR_LOC I WHERE I.SETID = A.SETID AND I.VENDOR_ID = A.VENDOR_ID AND I.VNDR_LOC = A.VNDR_LOC AND I.EFFDT <= %CurrentDateIn) AND B.SETID = A.SETID AND B.VENDOR_ID = A.VENDOR_ID AND B.VNDR_LOC = A.VNDR_LOC AND A.SETID = V.SETID AND A.VENDOR_ID = V.VENDOR_ID AND NOT EXISTS ( SELECT 1 FROM PS_VNDRLOCSCROL_LG WHERE SETID=A.SETID AND VENDOR_ID=A.VENDOR_ID AND VNDR_LOC=A.VNDR_LOC AND LANGUAGE_CD=V.LANGUAGE_CD )
|