SELECT SSBSECT_TERM_CODE
,SSBSECT_CRN
,SSBSECT_SUBJ_CODE
,SSBSECT_CRSE_NUMB
,SSBSECT_ACCT_CODE
,SFRSTCR_GRDE_CODE
,SSBSECT_PTRM_END_DATE
,F_GETSPRIDENID(SIRASGN_PIDM) AS "BANNER ID"
,F_FORMAT_NAME(SIRASGN_PIDM, 'FL')
FROM SSBSECT
LEFT JOIN SFRSTCR ON SSBSECT_TERM_CODE = SFRSTCR_TERM_CODE AND SSBSECT_CRN = SFRSTCR_CRN
LEFT JOIN SIRASGN ON SSBSECT_TERM_CODE = SIRASGN_TERM_CODE AND SSBSECT_CRN = SIRASGN_CRN
WHERE SSBSECT_SSTS_CODE = 'A'
--AND SSBSECT_TERM_CODE IN ('202130','202210','202220')
AND SSBSECT_ACCT_CODE IN ('P','E')
AND SFRSTCR_ATTEND_HR IS NULL
AND (SFRSTCR_GRDE_CODE IS NOT NULL AND SFRSTCR_GRDE_CODE NOT IN ('W','NP','I','NC','EW','F','NG'))
AND SIRASGN_PRIMARY_IND = 'Y'
ORDER BY SSBSECT_TERM_CODE DESC |