﻿UPDATE c2 SET
  Torolt = 'T'
  ,C_Alapertelmezett = 'F'
  ,Serial = C2.Serial + 1
  ,Lastchanged = GETDATE()
  ,Modifier = 0
FROM
  T_CIM AS C1
  INNER JOIN T_CIM AS C2 ON c2.Torolt = 'F' AND c1.Id = c2.Elozotanevirekordid
  INNER JOIN T_TANEV AS T2 ON T2.Torolt = 'F' AND t2.C_Nev = '2020/2021' AND t2.Id = c2.C_Tanevid
WHERE c1.Torolt = 'T';