UPDATE urunler u
JOIN birimler b ON UPPER(u.birim) = UPPER(b.birim_adi)
SET u.birim_kodu = b.birim_kodu
WHERE u.birim IS NOT NULL AND u.birim != '';