Benjamin Buxbaum: mysql Statement gesucht

Beitrag lesen

Hi Ilja!

UPDATE Tabelle_1 t1 SET t1.Spalte_1 = (SELECT t2.Spalte_1
                                       FROM Tabelle_2 t2
                                       t2.Spalte_2  = t1.Spalte_2
                                      )
WHERE EXISTS (SELECT NULL
              FROM Tabelle_2 t2
              t2.Spalte_2  = t1.Spalte_2
             )
;

Fehlen da nicht die WHERE keywords? Also wie folgt:

UPDATE Tabelle_1 t1 SET t1.Spalte_1 = (SELECT t2.Spalte_1
                                       FROM Tabelle_2 t2
                                       WHERE t2.Spalte_2  = t1.Spalte_2
                                      )
WHERE EXISTS (SELECT NULL
              FROM Tabelle_2 t2
              WHERE t2.Spalte_2  = t1.Spalte_2
             )
;

mfG
Benjamin

--
For animals, the entire universe has been neatly divided into things to (a) mate with, (b) eat, (c) run away from, and (d) rocks.