@ -123,6 +123,7 @@ on (H.st_studstamm_nr=T.st_studstamm_nr
@@ -123,6 +123,7 @@ on (H.st_studstamm_nr=T.st_studstamm_nr
- - Ermittlung msg bei TSG :
update tmp_studien2 set st_studiengang_nr_msg = M . st_studiengang_nr_msg
from costage_st_studiengaenge_mtsg M , costage_st_studien ST
where ST . st_studiengang_nr = M . st_studiengang_nr_msg
@ -130,7 +131,6 @@ and ST.st_studstamm_nr=tmp_studien2.st_studstamm_nr
@@ -130,7 +131,6 @@ and ST.st_studstamm_nr=tmp_studien2.st_studstamm_nr
and M . st_studiengang_nr_tsg = tmp_studien2 . st_studiengang_nr
and tmp_studien2 . studiengangs_typ_kb = ' TSG '
;
- - statustyp bei TSG aus MSG nachladen :
update tmp_studien2 set studienstatustyp = S . studienstatustyp
from tmp_studien S
@ -146,6 +146,17 @@ and S.status_historie=1
@@ -146,6 +146,17 @@ and S.status_historie=1
< #if K_COSTAGE_TSG_GENERATE == 1>
- - alle möglichen TSG / MSG - Kombinationen laden :
select T . * , M . st_studiengang_nr_msg as st_studiengang_nr_msg_possible , ST . st_studium_nr as st_studium_nr_msg_possible
into temp tmp_studien3
from tmp_studien2 T , costage_st_studiengaenge_mtsg M , costage_st_studien ST
where ST . st_studiengang_nr = M . st_studiengang_nr_msg
and ST . st_studstamm_nr = T . st_studstamm_nr
and M . st_studiengang_nr_tsg = T . st_studiengang_nr
and T . studiengangs_typ_kb = ' TSG '
;
- - Start - und Endsemester aller MSG pro Student :
drop table if exists tmp_studien_msg ;
select T . st_studiengang_nr as st_studiengang_nr_msg ,
@ -170,10 +181,10 @@ E.st_sem_nr,
@@ -170,10 +181,10 @@ E.st_sem_nr,
M . startsemester ,
M . endsemester
into temp tmp_studien_msg_tsg
from tmp_studien_msg M , tmp_studien2 T , costage_st_semester E
where M . st_studiengang_nr_msg = T . st_studiengang_nr_msg
from tmp_studien_msg M , tmp_studien3 T , costage_st_semester E
where M . st_studiengang_nr_msg = T . st_studiengang_nr_msg_possible
and M . st_studstamm_nr = T . st_studstamm_nr
and T . semester between M . startsemester and M . endsemester
- - and T . semester between M . startsemester and M . endsemester
and E . semester_tid between M . startsemester and M . endsemester
and T . studiengangs_typ_kb = ' TSG '
;
@ -182,8 +193,8 @@ drop table if exists tmp_studien_msg_tsg_fehlend;
@@ -182,8 +193,8 @@ drop table if exists tmp_studien_msg_tsg_fehlend;
select T . *
into temp tmp_studien_msg_tsg_fehlend
from tmp_studien_msg_tsg T - - enthält alle möglichen TSG
left outer join tmp_studien2 T2 - - enthält die tatsächlich vorhandenen TSG
on ( T2 . st_studiengang_nr_msg = T . st_studiengang_nr_msg
left outer join tmp_studien3 T2 - - enthält die tatsächlich vorhandenen TSG
on ( T2 . st_studiengang_nr_msg_possible = T . st_studiengang_nr_msg
and T2 . st_studiengang_nr = T . st_studiengang_nr_tsg
and T2 . st_studstamm_nr = T . st_studstamm_nr
and T2 . studiengangs_typ_kb = ' TSG '
@ -242,7 +253,7 @@ S.ca12_staat,
@@ -242,7 +253,7 @@ S.ca12_staat,
S . second_nationality ,
S . fachkennzeichen ,
S . studienform_statistik_code ,
S . st_studiengang_nr_msg ,
M . st_studiengang_nr_msg ,
S . st_studiengang_nr_tsg ,
null : : char ( 10 ) as hrst , - - hrst kann im Studienverlauf wechseln , daher nachher vom MSG nachladen
S . hssem ,
@ -251,8 +262,8 @@ null::char(10) as statustyp_tsg,
@@ -251,8 +262,8 @@ null::char(10) as statustyp_tsg,
0 as primaerflag , - - geschlossene TSG können kein Primärflag haben
S . hzb_art ,
max ( S . fachsemester )
from tmp_studien_msg_tsg_fehlend M , tmp_studien2 S - - , costage_st_semester E
where M . st_studiengang_nr_msg = S . st_studiengang_nr_msg
from tmp_studien_msg_tsg_fehlend M , tmp_studien3 S - - , costage_st_semester E
where M . st_studiengang_nr_msg = S . st_studiengang_nr_msg_possible
and M . st_studiengang_nr_tsg = S . st_studiengang_nr
and M . st_studstamm_nr = S . st_studstamm_nr
and S . studiengangs_typ_kb = ' TSG '
@ -291,15 +302,12 @@ and tmp_studien2.fachsemester=S.fachsemester
@@ -291,15 +302,12 @@ and tmp_studien2.fachsemester=S.fachsemester
drop table tmp_studien_msg_tsg_fehlend ;
drop table tmp_studien_msg_tsg ;
drop table tmp_studien_msg ;
drop table tmp_studien3 ;
< / #if>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
drop table tmp_studien ;
- - Ermittlung fach_nr :
@ -326,9 +334,9 @@ from cifx where key=400
@@ -326,9 +334,9 @@ from cifx where key=400
and apnr = tmp_studien2 . studienstatustyp
) ;
-- update tmp_studien2 set kz_rueck_beur_ein=(select val(astat)
-- update tmp_studien3 set kz_rueck_beur_ein=(select val(astat)
-- from cifx where key=400
-- and apnr=tmp_studien2 .statustyp_tsg
-- and apnr=tmp_studien3 .statustyp_tsg
-- )
-- where kz_rueck_beur_ein is null;
@ -421,33 +429,11 @@ select st_studium_nr,
@@ -421,33 +429,11 @@ select st_studium_nr,
( case when studiengangs_typ_kb = ' TSG ' then st_studiengang_nr_msg else st_studium_nr end ) ) + 1
end )
as studiengang_nr ,
- - AP Code :
-- (case when studiengangs_typ_kb ='TSG' then
-- (case when primaerflag =1
-- then 1
-- else
-- (case when st_studiengang_nr_msg in (select distinct T2.st_studiengang_nr_msg from temp_tmp_studien2 T2
-- where tmp_studien2.matrikelnummer = T2.matrikelnummer and tmp_studien2.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_nr2 ,
( case when primaerflag = 1 then 1
else
dense_rank ( ) over ( partition by semester , st_studstamm_nr , studiengang_nr
order by primaerflag desc , fach_nr )
end ) as fach_nr ,
- - TODO probieren :
-- ROW_NUMBER() over (partition by semester, st_studstamm_nr,studiengang_nr
-- order by primaerflag desc,fach_nr)
-- end)+1 as fach_nr,
unikey ,
beginn_datum as anfdat ,
( case when studienstatustyp not in ( ' Z ' , ' X ' ) then null : : date
@ -602,5 +588,5 @@ and A.st_adresse_typ='H'
@@ -602,5 +588,5 @@ and A.st_adresse_typ='H'
drop table tmp_studien2 ;
drop table tmp_primaer_msg ;
drop table temp_tmp_studien2 ;