SELECT DISTINCT A.COURSE , A.SESSION_NBR , D.BUSINESS_UNIT , B.EMPLID , D.DEMAND_ID , D.LANGUAGE_CD , D.DESCR FROM PS_CRSE_SESSN_TBL A , PS_JOB B , PS_TRN_DEMAND_LANG D , PS_BUDGET_PERIOD G , PS_BUDGET_BUS_UNIT M , PS_TRN_DEMAND N WHERE D.BUDGET_PERIOD = N.BUDGET_PERIOD AND D.BUSINESS_UNIT = N.BUSINESS_UNIT AND D.DEMAND_ID = N.DEMAND_ID AND ((EXISTS ( SELECT E.DEPTID FROM PS_TRN_DEMAND_DEPT E WHERE B.DEPTID = E.DEPTID AND D.BUDGET_PERIOD = E.BUDGET_PERIOD AND D.DEMAND_ID = E.DEMAND_ID) AND EXISTS ( SELECT F.JOBCODE FROM PS_TRN_DMND_JOBCD F WHERE B.JOBCODE = F.JOBCODE AND D.BUDGET_PERIOD = F.BUDGET_PERIOD AND D.DEMAND_ID = F.DEMAND_ID)) OR (D.EMPLID = B.EMPLID)) AND G.BUDGET_PERIOD = D.BUDGET_PERIOD AND G.EFFDT <= A.COURSE_START_DT AND G.THRU_DATE >= A.COURSE_END_DT AND B.EFFDT = ( SELECT MAX(C.EFFDT) FROM PS_JOB C WHERE C.EMPLID = B.EMPLID AND C.EFFDT <= A.COURSE_START_DT AND C.EMPL_RCD = B.EMPL_RCD) AND B.EFFSEQ = ( SELECT MAX(C.EFFSEQ) FROM PS_JOB C WHERE C.EMPLID = B.EMPLID AND C.EFFDT = B.EFFDT AND C.EMPL_RCD = B.EMPL_RCD) AND G.BUDGET_PERIOD = M.BUDGET_PERIOD AND M.BUSINESS_UNIT = D.BUSINESS_UNIT
|