UPDATE _import_optical_groups 
  SET lanc_kapcsolt_kod = 9000001
  WHERE  fajta_kod = 2;

UPDATE _import_optical_groups 
  SET lanc_kapcsolt_kod = 
     (SELECT iog.kod 
        FROM _import_optical_groups iog
       WHERE iog.fajta_kod = 2 
         AND iog.lang_0000040e = _import_optical_groups.nev_egyutt)
  WHERE  fajta_kod = 3;

 UPDATE _import_optical_groups 
  SET lanc_kapcsolt_kod = 
     (SELECT iog.kod 
        FROM _import_optical_groups iog
        INNER JOIN _import_optical_groups iog_2 ON iog_2.kod = iog.lanc_kapcsolt_kod
       WHERE iog.fajta_kod = 3 
         AND trim(iog.lang_0000040e||'×'||iog_2.lang_0000040e) = trim(_import_optical_groups.nev_egyutt))
  WHERE  fajta_kod = 4;

UPDATE _import_optical_groups 
  SET lanc_kapcsolt_kod = 
     (SELECT iog.kod 
        FROM _import_optical_groups iog
        INNER JOIN _import_optical_groups iog_3 ON iog_3.kod = iog.lanc_kapcsolt_kod
        INNER JOIN _import_optical_groups iog_2 ON iog_2.kod = iog_3.lanc_kapcsolt_kod
       WHERE iog.fajta_kod = 4 
         AND trim(iog.lang_0000040e||'×'||iog_3.lang_0000040e||'×'||iog_2.lang_0000040e) = trim(_import_optical_groups.nev_egyutt))
  WHERE  fajta_kod = 5;

 UPDATE _import_optical_groups 
  SET lanc_kapcsolt_kod = 
     (SELECT iog.kod 
        FROM _import_optical_groups iog
        INNER JOIN _import_optical_groups iog_4 ON iog_4.kod = iog.lanc_kapcsolt_kod
        INNER JOIN _import_optical_groups iog_3 ON iog_3.kod = iog_4.lanc_kapcsolt_kod
        INNER JOIN _import_optical_groups iog_2 ON iog_2.kod = iog_3.lanc_kapcsolt_kod
       WHERE iog.fajta_kod = 5 
         AND trim(iog.lang_0000040e||'×'||iog_4.lang_0000040e||'×'||iog_3.lang_0000040e||'×'||iog_2.lang_0000040e) = trim(_import_optical_groups.nev_egyutt))
  WHERE  fajta_kod = 6;