SELECT DTL.CONTRACT_NUM , DTL.BUSINESS_UNIT_PC , DTL.PROJECT_ID , PRJACT.ACTIVITY_ID , PRJ.START_DT , PRJ.END_DT , PRJACT.START_DT , PRJACT.END_DT FROM PS_CA_DETAIL_PROJ DTL , PS_PROJECT PRJ , PS_PROJECT_STATUS ST , PS_PROJ_ACTIVITY PRJACT WHERE DTL.BUSINESS_UNIT_PC = PRJ.BUSINESS_UNIT AND DTL.PROJECT_ID = PRJ.PROJECT_ID AND ST.BUSINESS_UNIT = PRJ.BUSINESS_UNIT AND ST.PROJECT_ID = PRJ.PROJECT_ID AND PRJACT.BUSINESS_UNIT = DTL.BUSINESS_UNIT_PC AND PRJACT.PROJECT_ID = DTL.PROJECT_ID AND PRJACT.ACTIVITY_ID = DTL.ACTIVITY_ID AND ST.EFFDT = ( SELECT MAX(ST1.EFFDT) FROM PS_PROJECT_STATUS ST1 WHERE ST1.BUSINESS_UNIT = ST.BUSINESS_UNIT AND ST1.PROJECT_ID = ST.PROJECT_ID AND ST1.EFFDT <=%CurrentDateIn) AND ST.EFFSEQ = ( SELECT MAX(ST2.EFFSEQ) FROM PS_PROJECT_STATUS ST2 WHERE ST2.BUSINESS_UNIT = ST.BUSINESS_UNIT AND ST2.PROJECT_ID = ST.PROJECT_ID AND ST2.EFFDT = ST.EFFDT)
|