select
gwid,
spidm,
ctrm,
ctrm_yr,
ctrm_sort,
gamaj11,
gacol,
ehrs_cum,
gpa_hrs gpa_hrs1,
nod_gpahrs GPA_HRS2,
to_char(avg(GPA),'fm99990.00') GPA,
to_char(nvl(avg(pts),0),'fm999999990.00') pts,
to_char(avg(GPA2),'fm999990.00') GPA2,
shrttrm_astd_code_end_of_term,
to_char(SUM(ehrs_cum) OVER (ORDER BY ctrm_yr,ctrm_sort RANGE UNBOUNDED PRECEDING),'fm99990.00') ehrs_cum_ext,
to_char(SUM(gpa_hrs) OVER (ORDER BY ctrm_yr,ctrm_sort RANGE UNBOUNDED PRECEDING),'fm99990.00') gpa_hrs_ext,
to_char(SUM(avg(GPA)) OVER (ORDER BY ctrm_yr,ctrm_sort RANGE UNBOUNDED PRECEDING),'fm99990.00') gpa_ext,
to_char(SUM(avg(pts)) OVER (ORDER BY ctrm_yr,ctrm_sort RANGE UNBOUNDED PRECEDING),'fm99990.00') pts_ext,
shrttrm_astd_code_dl
from (
select
distinct gwid,
spidm,
ctrm,
ctrm_yr,
ctrm_sort,
gamaj11,
gacol,
to_char(round(ehrs_cum),'fm999990.00') ehrs_cum,
to_char(round(gpa_hrs),'fm999990.00') gpa_hrs,
to_char(gpa,'fm999990.00') gpa,
pts pts,
to_char(round(nod_gpahrs),'fm999990.00') nod_gpahrs,
tqpts,
to_char(GPA2,'fm999990.00') GPA2,
shrttrm_astd_code_end_of_term,
shrttrm_astd_code_dl
from
(
select
gzrbipr_char_3 gwid,
gzrbipr_char_4 spidm,
gzrbipr_char_77 ctrm ,
SUBSTR(gzrbipr_char_77,instr(gzrbipr_char_77,' ',-1,1)+1) ctrm_yr,
(case when SUBSTR(gzrbipr_char_77,1,instr(gzrbipr_char_77,' ',-1,1)-1)='Spring' then 'a'
when SUBSTR(gzrbipr_char_77,1,instr(gzrbipr_char_77,' ',-1,1)-1)='Summer' then 'b'
when SUBSTR(gzrbipr_char_77,1,instr(gzrbipr_char_77,' ',-1,1)-1)='Fall' then 'c'
else null
end ) ctrm_sort,
gzrbipr_char_31 gacol ,
gzrbipr_char_36 gamaj11 ,
gzrbipr_char_88 ehrs_cum ,
nvl(gzrbipr_char_91,0) gpa_hrs ,
nvl(gzrbipr_char_165,0) gpa ,
( case when gzrbipr_char_167='Y' THEN (case when gzrbipr_char_69 < '199303' then nvl(gzrbipr_char_166,0) end)
else nvl(gzrbipr_char_166,0)
end) pts,
nvl(gzrbipr_char_91,0) nod_gpahrs,
nvl(gzrbipr_char_166,0) tqpts
,
(case when gzrbipr_char_91>0 then gzrbipr_char_166/gzrbipr_char_91 end)GPA2,
gzrbipr_char_82 shrttrm_astd_code_end_of_term,
gzrbipr_char_83 shrttrm_astd_code_dl
from gzrbipr
)
group by
gwid,
spidm,
ctrm,
ctrm_yr,
ctrm_sort,
gamaj11,
gacol,
ehrs_cum,
gpa_hrs,
gpa,
pts,
nod_gpahrs,
tqpts,
shrttrm_astd_code_end_of_term,
shrttrm_astd_code_dl
,
GPA2
)
where gwid='G14759230'
Group by
gwid,
spidm,
ctrm,
ctrm_yr,
ctrm_sort,
gamaj11,
gacol,
ehrs_cum,
gpa_hrs ,
nod_gpahrs,
shrttrm_astd_code_end_of_term,
shrttrm_astd_code_dl
order by ctrm_yr,ctrm_sort
gwid,
spidm,
ctrm,
ctrm_yr,
ctrm_sort,
gamaj11,
gacol,
ehrs_cum,
gpa_hrs gpa_hrs1,
nod_gpahrs GPA_HRS2,
to_char(avg(GPA),'fm99990.00') GPA,
to_char(nvl(avg(pts),0),'fm999999990.00') pts,
to_char(avg(GPA2),'fm999990.00') GPA2,
shrttrm_astd_code_end_of_term,
to_char(SUM(ehrs_cum) OVER (ORDER BY ctrm_yr,ctrm_sort RANGE UNBOUNDED PRECEDING),'fm99990.00') ehrs_cum_ext,
to_char(SUM(gpa_hrs) OVER (ORDER BY ctrm_yr,ctrm_sort RANGE UNBOUNDED PRECEDING),'fm99990.00') gpa_hrs_ext,
to_char(SUM(avg(GPA)) OVER (ORDER BY ctrm_yr,ctrm_sort RANGE UNBOUNDED PRECEDING),'fm99990.00') gpa_ext,
to_char(SUM(avg(pts)) OVER (ORDER BY ctrm_yr,ctrm_sort RANGE UNBOUNDED PRECEDING),'fm99990.00') pts_ext,
shrttrm_astd_code_dl
from (
select
distinct gwid,
spidm,
ctrm,
ctrm_yr,
ctrm_sort,
gamaj11,
gacol,
to_char(round(ehrs_cum),'fm999990.00') ehrs_cum,
to_char(round(gpa_hrs),'fm999990.00') gpa_hrs,
to_char(gpa,'fm999990.00') gpa,
pts pts,
to_char(round(nod_gpahrs),'fm999990.00') nod_gpahrs,
tqpts,
to_char(GPA2,'fm999990.00') GPA2,
shrttrm_astd_code_end_of_term,
shrttrm_astd_code_dl
from
(
select
gzrbipr_char_3 gwid,
gzrbipr_char_4 spidm,
gzrbipr_char_77 ctrm ,
SUBSTR(gzrbipr_char_77,instr(gzrbipr_char_77,' ',-1,1)+1) ctrm_yr,
(case when SUBSTR(gzrbipr_char_77,1,instr(gzrbipr_char_77,' ',-1,1)-1)='Spring' then 'a'
when SUBSTR(gzrbipr_char_77,1,instr(gzrbipr_char_77,' ',-1,1)-1)='Summer' then 'b'
when SUBSTR(gzrbipr_char_77,1,instr(gzrbipr_char_77,' ',-1,1)-1)='Fall' then 'c'
else null
end ) ctrm_sort,
gzrbipr_char_31 gacol ,
gzrbipr_char_36 gamaj11 ,
gzrbipr_char_88 ehrs_cum ,
nvl(gzrbipr_char_91,0) gpa_hrs ,
nvl(gzrbipr_char_165,0) gpa ,
( case when gzrbipr_char_167='Y' THEN (case when gzrbipr_char_69 < '199303' then nvl(gzrbipr_char_166,0) end)
else nvl(gzrbipr_char_166,0)
end) pts,
nvl(gzrbipr_char_91,0) nod_gpahrs,
nvl(gzrbipr_char_166,0) tqpts
,
(case when gzrbipr_char_91>0 then gzrbipr_char_166/gzrbipr_char_91 end)GPA2,
gzrbipr_char_82 shrttrm_astd_code_end_of_term,
gzrbipr_char_83 shrttrm_astd_code_dl
from gzrbipr
)
group by
gwid,
spidm,
ctrm,
ctrm_yr,
ctrm_sort,
gamaj11,
gacol,
ehrs_cum,
gpa_hrs,
gpa,
pts,
nod_gpahrs,
tqpts,
shrttrm_astd_code_end_of_term,
shrttrm_astd_code_dl
,
GPA2
)
where gwid='G14759230'
Group by
gwid,
spidm,
ctrm,
ctrm_yr,
ctrm_sort,
gamaj11,
gacol,
ehrs_cum,
gpa_hrs ,
nod_gpahrs,
shrttrm_astd_code_end_of_term,
shrttrm_astd_code_dl
order by ctrm_yr,ctrm_sort