Re: UPDATE statement...
Posted in 1998
Paul Roberts wrote: > >UPDATE tableA, tableB > >SET tableA.UserName = tableB.NewName > >WHERE tableA.Name = tableB.OldName; > If that's what you want to do, then try this: > > update tableA > set first_name = ( select tableB.new > from tableB > where tableB.old = tableA.first_name ) ; Shouldn't you add the line where first_name in (select old from tableB) I seem to remember that otherwise, for rows in tableA that have no matching field "old" in tableB, "first_name" could be updated to NULL. Please correct me if I'm wrong. Regards, Richard -- +--------------------------+------------------------------------------+ | Dr. Richard Spitz | INTERNET: spitz@ana.med.uni-muenchen.de | | EDV-Gruppe Anaesthesie | Tel : +49-89-7095-3413 | | Klinikum Grosshadern | FAX : +49-89-7095-8886 | | 81366 Munich, Germany | GSM : +49-172-8933578 | +--------------------------+------------------------------------------+