You can use more than one table in single update query but you can not update more than one table in single update query in Sql Server.
You have two tables on the base of them you want to fire update statement. Than you can do it like :-
Update Table1 set Field1 ='Name' from Table2 where Table1.ID=Table2.ID
Even you can use more than two tables in a single update query like..
Update Table1 set Field1 ='Name' from Table2,Table3 where Table1.id=Table2.id and Table1.Id= Table3.Id
But you can not update two tables in one query in SQL Server.
In MYSQL it is possible to update two tables in Single Query..
update schoolsdata t1, schoolblog t2 set t1.state='A', t2.studentcomments='Z' where t1.collegeid = t2.collegeid and t1.collegeid=40
You have two tables on the base of them you want to fire update statement. Than you can do it like :-
Update Table1 set Field1 ='Name' from Table2 where Table1.ID=Table2.ID
Even you can use more than two tables in a single update query like..
Update Table1 set Field1 ='Name' from Table2,Table3 where Table1.id=Table2.id and Table1.Id= Table3.Id
But you can not update two tables in one query in SQL Server.
In MYSQL it is possible to update two tables in Single Query..
update schoolsdata t1, schoolblog t2 set t1.state='A', t2.studentcomments='Z' where t1.collegeid = t2.collegeid and t1.collegeid=40
No comments:
Post a Comment