SELECT ITEM.EMPLID , ITEM.INSTITUTION , ITEM.SSR_APT_INSTANCE , ITEM.SSR_APT_ITEM_SEQ , ITEM.SSR_ITEM_ID , ITEM.SSR_ITEM_TYPE , HDR.DESCR50 , ATT.SSR_CREDITS , ATT.ATTEMPT_NBR , ITEM.SSR_ENRL_CAT , ENRL.SSR_ALLOW_APT , TERM.STRM , TERM.DESCRSHORT FROM PS_SSR_APT_ITEM ITEM , PS_SSR_APT_ATT ATT , PS_SSR_APT_HDR APT , PS_SSR_AIR_HDR HDR , PS_TERM_TBL TERM , PS_SSR_ENRL_CAT ENRL WHERE APT.EMPLID = ITEM.EMPLID AND APT.INSTITUTION = ITEM.INSTITUTION AND APT.SSR_APT_INSTANCE = ITEM.SSR_APT_INSTANCE AND ITEM.EMPLID = ATT.EMPLID AND ITEM.INSTITUTION = ATT.INSTITUTION AND ITEM.SSR_APT_INSTANCE = ATT.SSR_APT_INSTANCE AND ITEM.SSR_APT_ITEM_SEQ = ATT.SSR_APT_ITEM_SEQ AND ATT.ATTEMPT_NBR = ( SELECT MAX(ATT_B.ATTEMPT_NBR) FROM PS_SSR_APT_ATT ATT_B WHERE ATT.EMPLID = ATT_B.EMPLID AND ATT.INSTITUTION = ATT_B.INSTITUTION AND ATT.SSR_APT_INSTANCE = ATT_B.SSR_APT_INSTANCE AND ATT.SSR_APT_ITEM_SEQ = ATT_B.SSR_APT_ITEM_SEQ) AND TERM.INSTITUTION = APT.INSTITUTION AND TERM.ACAD_CAREER = APT.ACAD_CAREER AND TERM.STRM = APT.REQ_TERM AND ITEM.INSTITUTION = HDR.INSTITUTION AND ITEM.SSR_ITEM_ID = HDR.SSR_ITEM_ID AND HDR.EFFDT <= TERM.TERM_BEGIN_DT AND HDR.END_EFFDT >= TERM.TERM_BEGIN_DT AND HDR.EFF_STATUS='A' AND ITEM.SSR_ITEM_TYPE ='COURSE' AND ENRL.INSTITUTION = ITEM.INSTITUTION AND ENRL.SSR_ENRL_CAT = ITEM.SSR_ENRL_CAT
|