﻿--Migration
UPDATE f SET 
  f.TOROLT = 'T', f.LASTCHANGED = GETDATE(), f.MODIFIER = 0, f.SERIAL += 1
FROM T_FOGLALKOZAS f 
  INNER JOIN T_OSZTALYCSOPORT ocs ON ocs.ID = f.C_OSZTALYCSOPORTID AND ocs.TOROLT = 'F'
  INNER JOIN T_TANEV ftv ON ftv.ID = f.C_TANEVID AND ftv.TOROLT = 'F'
  INNER JOIN T_TANEV ocstv ON ocstv.ID = ocs.C_TANEVID AND ocstv.TOROLT = 'F'
  INNER JOIN T_INTEZMENY i ON i.ID = f.C_INTEZMENYID AND i.TOROLT = 'F'
WHERE ocs.C_TANEVID <> f.C_TANEVID
  AND f.TOROLT = 'F'
