Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Update based on anothe table

Author  Topic 

rama108
Posting Yak Master

115 Posts

Posted - 2013-05-17 : 14:26:18
how can i do this:

Update A
set Locked = b.Locked
FRom B b
where b.MID = MID

this is giving me erroe:
Ambiguous column name 'MID'.

djj55
Constraint Violating Yak Guru

352 Posts

Posted - 2013-05-17 : 14:30:21
You need to associate A with B in a join thus
 UPDATE A 
SET locked = b.locked
FROM A
INNER JOIN B ON A.MID = B.MID


djj
Go to Top of Page

rama108
Posting Yak Master

115 Posts

Posted - 2013-05-18 : 08:46:06
Thanks Dj.
Go to Top of Page
   

- Advertisement -