Browse Source

Computation of studiengang_nr refined #1

COStage_0.2_Release
Daniel Quathamer 3 years ago
parent
commit
7d26777c56
  1. 47
      src-modules/module/costage/hilfstabellen/costage_st_studien_aggr_fuellen.sql

47
src-modules/module/costage/hilfstabellen/costage_st_studien_aggr_fuellen.sql

@ -177,8 +177,19 @@ and T.st_studiengang_nr_msg=tmp_studien2.st_studiengang_nr_msg
) )
; ;
select distinct st_studiengang_nr_msg, matrikelnummer, semester
into temp temp_tmp_studien2
from tmp_studien2
where primaerflag =1
and studiengangs_typ_kb ='TSG';
delete from costage_st_studien_aggr;
delete from costage_st_studien_aggr
--provisorisch in Testphase:
where ${COSTAGE_STUDENT_FILTER};
;
insert into costage_st_studien_aggr( insert into costage_st_studien_aggr(
st_studium_nr, st_studium_nr,
st_studstamm_nr, st_studstamm_nr,
@ -213,12 +224,32 @@ select st_studium_nr,
hssem, hssem,
primaerflag, primaerflag,
--Nun ist studiengang_nr=1 definiert. Die restlichen werden mit RANK ermittelt: --Nun ist studiengang_nr=1 definiert. Die restlichen werden mit RANK ermittelt:
(case when studiengang_nr is not null then studiengang_nr -- (case when studiengang_nr is not null then studiengang_nr
else -- else
dense_rank () over (partition by semester, st_studstamm_nr,studiengang_nr order by -- dense_rank () over (partition by semester, st_studstamm_nr,studiengang_nr order by
(case when studiengangs_typ_kb='TSG' then st_absz_nr else st_studium_nr end ))+1 -- (case when studiengangs_typ_kb='TSG' then st_absz_nr else st_studium_nr end ))+1
end) -- end)
as studiengang_nr, -- as studiengang_nr,
(case when studiengangs_typ_kb ='TSG' then
(case when primaerflag =1
then 1
else
(case when st_studiengang_nr_msg in (select distinct T1.st_studiengang_nr_msg from tmp_studien2 T1, temp_tmp_studien2 T2
where T1.matrikelnummer = T2.matrikelnummer and T1.st_studiengang_nr_msg = T2.st_studiengang_nr_msg and T1.semester = T2.Semester)
then 1
else
dense_rank () over (partition by semester, st_studstamm_nr,studiengang_nr order by(case when studiengangs_typ_kb='TSG' then st_absz_nr else st_studium_nr end ))+1
end )end)
else
(case when primaerflag =1
then 1
else
dense_rank () over (partition by semester, st_studstamm_nr,studiengang_nr
order by(case when studiengangs_typ_kb='TSG'
then st_absz_nr
else st_studium_nr end ))+1
end)
end ) as studiengang_nr,
(case when primaerflag =1 then 1 (case when primaerflag =1 then 1
else else
dense_rank () over (partition by semester, st_studstamm_nr,studiengang_nr dense_rank () over (partition by semester, st_studstamm_nr,studiengang_nr
@ -237,4 +268,6 @@ select st_studium_nr,
drop table tmp_studien2; drop table tmp_studien2;
drop table tmp_primaer_msg; drop table tmp_primaer_msg;
drop table temp_tmp_studien2;

Loading…
Cancel
Save