Thursday, February 4, 2010

Update a table with data from another existing table

Update a table with data from another existing table:

UPDATE tableToBeUpdated
SET fldToBeUpdate = (SELECT tblSource.fldToUpdate FROM tblSource WHERE tblSource.idOrder = tableToBeUpdated.idOrder)
WHERE EXISTS (SELECT tblSource.fldToUpdate FROM tblSource WHERE tblSource.idOrder = tableToBeUpdated.idOrder)

No comments: