SELECT id, code, value, substr(code, 1,2) sess, enrollment_year, case when substr(code, 8,1) = 'G' then 'GRAD' when substr(code, 8,1) = 'A' then 'UNDG' else 'UNDG' end prog, case when substr(code, 8,1) = 'A' then 'NT' else '' end subsess, case when substr(code, 8,1) = 'G' then 'GR' when substr(code, 8,1) = 'A' then 'EX' else 'UG' end || case when session_type_id = '100001' then enrollment_year - 2000 else (enrollment_year - 2001) end catalog FROM jxlive:enrollment_period order by enrollment_year, value;