SELECT A.SETID ,A.PROJECT_ID ,A.DESCR FROM PS_PROJECT_FS A , PS_PROJECT_STATUS B WHERE A.BUSINESS_UNIT = B.BUSINESS_UNIT AND A.PROJECT_ID = B.PROJECT_ID AND A.EFF_STATUS = 'A' AND B.EFFDT = ( SELECT MAX(B_ED.EFFDT) FROM PS_PROJECT_STATUS B_ED WHERE B.BUSINESS_UNIT = B_ED.BUSINESS_UNIT AND B.PROJECT_ID = B_ED.PROJECT_ID AND B_ED.EFFDT <= %CurrentDateIn) AND B.EFFSEQ = ( SELECT MAX(B_ES.EFFSEQ) FROM PS_PROJECT_STATUS B_ES WHERE B.BUSINESS_UNIT = B_ES.BUSINESS_UNIT AND B.PROJECT_ID = B_ES.PROJECT_ID AND B.EFFDT = B_ES.EFFDT) AND B.PROJECT_STATUS <> 'C'
|