kreta/Kreta.DataAccess.Migrations/Scripts/20210826101300_KRETA2_9600/KRETA2_9600.sql
2024-03-13 00:33:46 +01:00

19 lines
No EOL
1.2 KiB
SQL

update tcs2
set C_JOGVISZONYTIPUSID = tcs1.C_JOGVISZONYTIPUSID, MODIFIER = 0, LASTCHANGED = GETDATE(), SERIAL += 1
--select te1.ID, f1.C_NYOMTATASINEV, ocs2.C_NEV, ocs1.C_NEV, tcs1.ID, tcs1.C_JOGVISZONYTIPUSID, tcs2.ID, tcs2.C_JOGVISZONYTIPUSID, *
from T_TANULO t1
inner join T_FELHASZNALO f1 on f1.ID = t1.ID and f1.C_TANEVID = t1.C_ALTANEVID and f1.TOROLT = 'F'
inner join T_TANULOCSOPORT tcs1 on tcs1.C_TANULOID = t1.ID and tcs1.C_TANEVID = t1.C_ALTANEVID and tcs1.TOROLT = 'F' and tcs1.C_JOGVISZONYTIPUSID is not null
inner join T_OSZTALYCSOPORT ocs1 on ocs1.ID = tcs1.C_OSZTALYCSOPORTID and ocs1.TOROLT = 'F'
inner join T_TANEV te1 on te1.ID = t1.C_ALTANEVID and te1.TOROLT = 'F' and te1.C_NEV = '2020/2021'
inner join T_TANULO t2 on t2.ELOZOTANEVIREKORDID = t1.ID and t2.TOROLT = 'F'
inner join T_TANULOCSOPORT tcs2 on tcs2.C_TANULOID = t2.ID and tcs2.C_TANEVID = t2.C_ALTANEVID and tcs2.TOROLT = 'F' and tcs2.C_JOGVISZONYTIPUSID is not null
inner join T_OSZTALYCSOPORT ocs2 on ocs2.ID = tcs2.C_OSZTALYCSOPORTID and ocs2.TOROLT = 'F'
where t1.TOROLT = 'F'
and tcs1.C_KILEPESDATUM = '2021-08-31'
and ocs1.C_FELADATKATEGORIAID = ocs2.C_FELADATKATEGORIAID
and tcs1.C_JOGVISZONYTIPUSID <> tcs2.C_JOGVISZONYTIPUSID