﻿UPDATE tanulo
SET tanulo.C_MAGANTANULOSAGANAKOKA = 657
FROM T_TANULO tanulo
INNER JOIN T_MAGANTANULOSAGOKA magantan ON magantan.ID = tanulo.C_MAGANTANULOSAGANAKOKA
INNER JOIN T_DICTIONARYITEMBASE dic ON magantan.ID = dic.ID AND magantan.C_ALINTEZMENYID = dic.C_INTEZMENYID AND magantan.C_ALTANEVID = dic.C_TANEVID
WHERE dic.C_TYPE = 'MagantanulosagOka' AND dic.C_NAME = '[na]' AND tanulo.C_MAGANTANULO = 'T'


UPDATE tanulo
SET tanulo.C_MAGANTANULOSAGANAKOKA = NULL
FROM T_TANULO tanulo
INNER JOIN T_MAGANTANULOSAGOKA magantan ON magantan.ID = tanulo.C_MAGANTANULOSAGANAKOKA
INNER JOIN T_DICTIONARYITEMBASE dic ON magantan.ID = dic.ID AND magantan.C_ALINTEZMENYID = dic.C_INTEZMENYID AND magantan.C_ALTANEVID = dic.C_TANEVID
WHERE dic.C_TYPE = 'MagantanulosagOka' AND dic.C_NAME = '[na]' AND tanulo.C_MAGANTANULO = 'F'


UPDATE magantan
SET magantan.TOROLT = 'T'
FROM T_MAGANTANULOSAGOKA magantan
INNER JOIN T_DICTIONARYITEMBASE dic ON magantan.ID = dic.ID AND magantan.C_ALINTEZMENYID = dic.C_INTEZMENYID AND magantan.C_ALTANEVID = dic.C_TANEVID
WHERE dic.C_TYPE = 'MagantanulosagOka' AND dic.C_NAME = '[na]'


UPDATE T_DICTIONARYITEMBASE
SET TOROLT = 'T'
WHERE C_TYPE = 'MagantanulosagOka' AND C_NAME = '[na]'