﻿UPDATE dib SET dib.ELOZOTANEVIREKORDID = dib.ID
FROM T_DICTIONARYITEMBASE dib
INNER JOIN T_TANEV t ON t.ID = dib.C_TANEVID AND t.TOROLT = 'F' AND t.ID <> (SELECT MIN(t2.ID) FROM T_TANEV t2 WHERE t2.C_INTEZMENYID = t.C_INTEZMENYID)
WHERE dib.ELOZOTANEVIREKORDID IS NULL and dib.TOROLT = 'F'
