Hi
How to use Single update Query for both tables
CREATE TABLE MAS1
(
Id int primary key identity(1,1),
MasName varchar(50),
Tempid int,
RefTempId int
)
CREATE TABLE MAS2
(
Id int primary key identity(1,1),
Tempid int,
RefTempid int
)
Insert into MAS1 values('John',1,2)
Insert into MAS1 values('John',3,5)
Insert into MAS1 values('John',8,11)
Insert into MAS2 values(1001,2001)
Insert into MAS2 values(3001,5001)
Insert into MAS2 values(8001,1001)
select * from MAS1
select * from MAS2
--I need single update Query but Both table column
My Query This
===================
UPDATE mas1 SET mas1.Tempid=mas2.Tempid
,mas1.RefTempid=mas2.RefTempid, mas2.RefTempid=mas1.RefTempId
FROM MAS1 mas1 JOIN MAS2 mas2 ON mas1.id=mas2.id
AND mas1.id=1
I tried in this Query but i meet this error any one fixed this
The multi-part identifier "mas2.RefTempid" could not be bound.
Mark as Answer if its helpful to you
Kumaraspcode2009@gmail.com