Daniel Quathamer
4 weeks ago
2 changed files with 179 additions and 0 deletions
@ -0,0 +1,166 @@ |
|||||||
|
|
||||||
|
--Wenn es bei archivierten Daten Verweise in sos_lab_stg.tid_stg auf |
||||||
|
--Nummern gibt, die es in lehr_stg_ab nicht gibt, |
||||||
|
--können Sie mit diesem SQL die tid_stg zurücksetzen |
||||||
|
|
||||||
|
--Im Ergebnis darf der SQL: |
||||||
|
-- select distinct tid_stg from sos_lab_stg where stichtag=4 |
||||||
|
-- and tid_stg not in (select tid from lehr_stg_ab) |
||||||
|
-- order by 1; |
||||||
|
--keinen Datensatz liefern |
||||||
|
|
||||||
|
UPDATE sos_lab_stg |
||||||
|
SET tid_stg = ( |
||||||
|
SELECT min(tid) |
||||||
|
FROM |
||||||
|
lehr_stg_ab L |
||||||
|
WHERE |
||||||
|
sos_lab_stg.ch30_fach_stg = L.stg |
||||||
|
AND sos_lab_stg.ch39_vertief_stg = L.vertfg |
||||||
|
AND sos_lab_stg.ch35_ang_abschluss_stg = L.abschluss |
||||||
|
AND sos_lab_stg.pversion_stg = L.pversion |
||||||
|
AND sos_lab_stg.schwerpunkt_stg = L.schwerpunkt |
||||||
|
AND L.semester_von <= sos_lab_stg.sem_der_pruefung |
||||||
|
AND L.semester_bis >= sos_lab_stg.sem_der_pruefung |
||||||
|
AND L.kz_fach = sos_lab_stg.kz_fach_stg |
||||||
|
AND L.stort = sos_lab_stg.stort |
||||||
|
AND L.stutyp = sos_lab_stg.stutyp |
||||||
|
); |
||||||
|
|
||||||
|
UPDATE sos_lab_stg |
||||||
|
SET tid_stg = ( |
||||||
|
SELECT min(tid) |
||||||
|
FROM |
||||||
|
lehr_stg_ab L |
||||||
|
WHERE |
||||||
|
sos_lab_stg.ch30_fach_stg = L.stg |
||||||
|
AND sos_lab_stg.ch39_vertief_stg = L.vertfg |
||||||
|
AND sos_lab_stg.ch35_ang_abschluss_stg = L.abschluss |
||||||
|
AND L.semester_von <= sos_lab_stg.sem_der_pruefung |
||||||
|
AND L.semester_bis >= sos_lab_stg.sem_der_pruefung |
||||||
|
AND L.kz_fach = sos_lab_stg.kz_fach_stg |
||||||
|
AND L.stort = sos_lab_stg.stort |
||||||
|
AND L.stutyp = sos_lab_stg.stutyp |
||||||
|
) |
||||||
|
WHERE tid_stg IS NULL; |
||||||
|
|
||||||
|
UPDATE sos_lab_stg |
||||||
|
SET tid_stg = ( |
||||||
|
SELECT min(tid) |
||||||
|
FROM |
||||||
|
lehr_stg_ab L |
||||||
|
WHERE |
||||||
|
sos_lab_stg.ch30_fach_stg = L.stg |
||||||
|
AND sos_lab_stg.ch39_vertief_stg = L.vertfg |
||||||
|
AND sos_lab_stg.ch35_ang_abschluss_stg = L.abschluss |
||||||
|
AND sos_lab_stg.pversion_stg = L.pversion |
||||||
|
AND sos_lab_stg.schwerpunkt_stg = L.schwerpunkt |
||||||
|
AND L.semester_von <= sos_lab_stg.sem_der_pruefung |
||||||
|
AND L.semester_bis >= sos_lab_stg.sem_der_pruefung |
||||||
|
AND L.kz_fach = sos_lab_stg.kz_fach_stg |
||||||
|
AND L.stutyp = sos_lab_stg.stutyp |
||||||
|
) |
||||||
|
WHERE tid_stg IS NULL; |
||||||
|
|
||||||
|
UPDATE sos_lab_stg |
||||||
|
SET tid_stg = ( |
||||||
|
SELECT min(tid) |
||||||
|
FROM |
||||||
|
lehr_stg_ab L |
||||||
|
WHERE |
||||||
|
sos_lab_stg.ch30_fach_stg = L.stg |
||||||
|
AND sos_lab_stg.ch39_vertief_stg = L.vertfg |
||||||
|
AND sos_lab_stg.ch35_ang_abschluss_stg = L.abschluss |
||||||
|
AND sos_lab_stg.schwerpunkt_stg = L.schwerpunkt |
||||||
|
AND L.semester_von <= sos_lab_stg.sem_der_pruefung |
||||||
|
AND L.semester_bis >= sos_lab_stg.sem_der_pruefung |
||||||
|
AND L.kz_fach = sos_lab_stg.kz_fach_stg |
||||||
|
AND L.stutyp = sos_lab_stg.stutyp |
||||||
|
) |
||||||
|
WHERE tid_stg IS NULL; |
||||||
|
|
||||||
|
UPDATE sos_lab_stg |
||||||
|
SET tid_stg = ( |
||||||
|
SELECT min(tid) |
||||||
|
FROM |
||||||
|
lehr_stg_ab L |
||||||
|
WHERE |
||||||
|
sos_lab_stg.ch30_fach_stg = L.stg |
||||||
|
AND sos_lab_stg.ch39_vertief_stg = L.vertfg |
||||||
|
AND sos_lab_stg.ch35_ang_abschluss_stg = L.abschluss |
||||||
|
AND L.semester_von <= sos_lab_stg.sem_der_pruefung |
||||||
|
AND L.semester_bis >= sos_lab_stg.sem_der_pruefung |
||||||
|
AND L.kz_fach = sos_lab_stg.kz_fach_stg |
||||||
|
AND L.stutyp = sos_lab_stg.stutyp |
||||||
|
) |
||||||
|
WHERE tid_stg IS NULL; |
||||||
|
|
||||||
|
--jetzt ohne stutyp: |
||||||
|
UPDATE sos_lab_stg |
||||||
|
SET tid_stg = ( |
||||||
|
SELECT min(tid) |
||||||
|
FROM |
||||||
|
lehr_stg_ab L |
||||||
|
WHERE |
||||||
|
sos_lab_stg.ch30_fach_stg = L.stg |
||||||
|
AND sos_lab_stg.ch39_vertief_stg = L.vertfg |
||||||
|
AND sos_lab_stg.ch35_ang_abschluss_stg = L.abschluss |
||||||
|
AND L.semester_von <= sos_lab_stg.sem_der_pruefung |
||||||
|
AND L.semester_bis >= sos_lab_stg.sem_der_pruefung |
||||||
|
AND L.kz_fach = sos_lab_stg.kz_fach_stg |
||||||
|
--AND L.stutyp = sos_lab_stg.stutyp |
||||||
|
) |
||||||
|
WHERE tid_stg IS NULL; |
||||||
|
|
||||||
|
-- wenn Studiengang des Studierenden nicht ermittelt werden kann, |
||||||
|
-- nehmen wir als fallback die Angaben der Prüfung: |
||||||
|
UPDATE sos_lab_stg |
||||||
|
SET tid_stg = ( |
||||||
|
SELECT min(tid) |
||||||
|
FROM |
||||||
|
lehr_stg_ab L |
||||||
|
WHERE |
||||||
|
sos_lab_stg.ch30_fach = L.stg |
||||||
|
AND sos_lab_stg.ch39_vertief = L.vertfg |
||||||
|
AND sos_lab_stg.ch35_ang_abschluss = L.abschluss |
||||||
|
AND sos_lab_stg.pversion = L.pversion |
||||||
|
AND sos_lab_stg.schwerpunkt = L.schwerpunkt |
||||||
|
AND L.semester_von <= sos_lab_stg.sem_der_pruefung |
||||||
|
AND L.semester_bis >= sos_lab_stg.sem_der_pruefung |
||||||
|
AND L.kz_fach = sos_lab_stg.kz_fach |
||||||
|
AND L.stutyp = sos_lab_stg.stutyp |
||||||
|
) |
||||||
|
WHERE tid_stg IS NULL; |
||||||
|
|
||||||
|
UPDATE sos_lab_stg |
||||||
|
SET tid_stg = ( |
||||||
|
SELECT min(tid) |
||||||
|
FROM |
||||||
|
lehr_stg_ab L |
||||||
|
WHERE |
||||||
|
sos_lab_stg.ch30_fach = L.stg |
||||||
|
AND sos_lab_stg.ch39_vertief = L.vertfg |
||||||
|
AND sos_lab_stg.ch35_ang_abschluss = L.abschluss |
||||||
|
AND L.semester_von <= sos_lab_stg.sem_der_pruefung |
||||||
|
AND L.semester_bis >= sos_lab_stg.sem_der_pruefung |
||||||
|
AND L.kz_fach = sos_lab_stg.kz_fach |
||||||
|
AND L.stutyp = sos_lab_stg.stutyp |
||||||
|
) |
||||||
|
WHERE tid_stg IS NULL; |
||||||
|
|
||||||
|
--jetzt ohne stutyp: |
||||||
|
UPDATE sos_lab_stg |
||||||
|
SET tid_stg = ( |
||||||
|
SELECT min(tid) |
||||||
|
FROM |
||||||
|
lehr_stg_ab L |
||||||
|
WHERE |
||||||
|
sos_lab_stg.ch30_fach = L.stg |
||||||
|
AND sos_lab_stg.ch39_vertief = L.vertfg |
||||||
|
AND sos_lab_stg.ch35_ang_abschluss = L.abschluss |
||||||
|
AND L.semester_von <= sos_lab_stg.sem_der_pruefung |
||||||
|
AND L.semester_bis >= sos_lab_stg.sem_der_pruefung |
||||||
|
AND L.kz_fach = sos_lab_stg.kz_fach |
||||||
|
--AND L.stutyp = sos_lab_stg.stutyp |
||||||
|
) |
||||||
|
WHERE tid_stg IS NULL; |
@ -0,0 +1,13 @@ |
|||||||
|
--freemarker template |
||||||
|
--Lösche Teststudenten: |
||||||
|
<#assign mtknr="9991,9992,9993,9994,9995,9996,9997,9998,9999,203508,203510,203514,376677,379874,386001,386006,404376" /> |
||||||
|
|
||||||
|
|
||||||
|
delete from sos_sos where matrikel_nr in (${mtknr}); |
||||||
|
delete from sos_stg where matrikel_nr in (${mtknr}); |
||||||
|
delete from sos_stg_aggr where matrikel_nr in (${mtknr}); |
||||||
|
delete from sos_lab where matrikel_nr in (${mtknr}); |
||||||
|
delete from sos_lab_stg where matrikel_nr in (${mtknr}); |
||||||
|
delete from sos_stg_verlauf where matrikel_nr in (${mtknr}); |
||||||
|
|
||||||
|
|
Loading…
Reference in new issue