Bei einem Update über meherere Tabellen muss sicher gestellt werden, dass es für jede Zeile die geändert werden soll genau eine Zeile in der zweiten Tabelle bzw. in dem SELECT-Statement vorhanden ist.
Die korrekte Syntax für den Update über meherere Tabellen sieht wie folgt aus:
Code:
update MyTable2 A
set (A.Feld1, A.Feld2) = (select Distinct B.Feld1, B.Feld2
from Mytable1 B
where A.Key1 = B.Key1
and A.Key2 = B.Key2)
where exists (select C.Key1, C.Key2
from MyTable1 C
where A.Key1 = C.Key1
and A.Key2 = C.Key2)
Birgitta
Bookmarks