Saturday, April 18, 2009

Updating a table using values from other table

UPDATE Table1
SET
T1Field1 = T2Field2
FROM Table1 INNER JOIN Table2
ON Table1.pk_id = Table2.pk_id


Here,
T1Field1 = Field in Table1 that is to be updated.
Table1.pk_id = Primary key in Table1
Table2.pk_id = Primary key in Table2

No comments:

Post a Comment