Code Snippets
Thursday, July 17, 2008
SQL: Update a table using another table
UPDATE Table1
SET Table1.fieldToBeUpdated=
(SELECT Table2.fieldToUpdateFrom
FROM Table2
WHERE Table2.commonID= Table1.commonID)
)
WHERE
EXISTS
(
SELECT Table2.fieldToUpdateFrom
FROM Table2
WHERE Table2.commonID= Table1.commonID)
)
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment