-- estimate select * from externalDataT ed join externalDataTL edl on ed.id = edl.id join tagTL tl on edl.name = tl.name and edl.languageId = tl.languageId join nodeT n on tl.id = n.id join nodeTypeT nt on n.nodeTypeId = nt.id where ed.externalDataSourceId = 'admter' and ed.tagId is null and ed.typeCode = nt.code; -- update update externalDataT ed join externalDataTL edl on ed.id = edl.id join tagTL tl on edl.name = tl.name and edl.languageId = tl.languageId join nodeT n on tl.id = n.id join nodeTypeT nt on n.nodeTypeId = nt.id set ed.tagId = tl.id where ed.externalDataSourceId = 'admter' and ed.tagId is null and tl.id in (9, 24, 4821);