SELECT MGR.PERSON_ID_MANAGER , U.TIMEFRAME_PERIOD , ID.FORECAST_ID FROM PS_RSF_ACC_MGR_VW MGR , PS_RSF_FCAST_USER U , PS_RSF_FCAST_ID ID WHERE U.PERSON_ID = MGR.PERSON_ID AND U.FORECAST_SUBMITTED = 'Y' AND U.FORECAST_CATEGORY = 'R' AND U.FORECAST_ID = ID.FORECAST_ID AND ID.FORECAST_DT = ( SELECT MAX(ID1.FORECAST_DT) FROM PS_RSF_FCAST_ID ID1 , PS_RSF_FCAST_USER U1 WHERE ID1.FORECAST_ID = U1.FORECAST_ID AND U1.TIMEFRAME_PERIOD = U.TIMEFRAME_PERIOD AND U1.FORECAST_SUBMITTED = 'Y') GROUP BY MGR.PERSON_ID_MANAGER , U.TIMEFRAME_PERIOD , ID.FORECAST_ID
|