Multi-Table Update mit Aliasen

Wichtig ist, dass

  • table1 nicht nochmal in FROM auftaucht (außer man möchte einen self-join machen)
  • man den Alias t1 bei SET nicht verwendet ( set t1.col1=... wirft einen Fehler)

update table1 as t1
set col1=t2.col1
from table2 as t2
where t1.id=t2.id;


Das "as" kann auch weggelassen werden.