Update two column from different table in single query in sql server? -
i have 3 tables
table1 sno sname amount 1 aaa 23 2 bbb 34 3 ccc 98 table2 sno sprice 1 34 2 78 3 87 table3 sno amount sprice 1 65 78 2 43 76 3 34 45
i want write single update query update table1 , table2 table compare table3
sno column.
result is
table1
sno sname amount 1 aaa 65 2 bbb 43 3 ccc 34 amount column value table3 updated table1 amount column.
table2
sno sprice 1 78 2 76 3 48
the sprice value of table3 updated table2 sprice column.
this 2 operation can in single update query itself.
if possible please me.
an update statement can ever affect single table (aside separate statements such might contained in trigger). why not wrap 2 update statements in transaction? goal of trying in single statement?
Comments
Post a Comment