UPDATE using SELECT Query
UPDATE Query using SELECT Query
You can also update table from other table or other SELECT query as shown below. In following example Table2 can be other SELECT query.
UPDATE Table1
SET
Column1=Table2.Column1
Column2=Table2.Column2
Column3=Table2.Column3
FROM Table2
WHERE Table1.ID=Table2.ID
Another Example
SET
tbl1.Column1=tbl2.Column1
tbl1.Column2=tbl2.Column2
FROM (SELECT Column1,Column2 FROM Table2) tbl2
WHERE tbl1.ID=tbl2.ID
Comments
Post a Comment