SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Update based on anothe table
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

rama108
Posting Yak Master

109 Posts

Posted - 05/17/2013 :  14:26:18  Show Profile  Reply with Quote
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

USA
317 Posts

Posted - 05/17/2013 :  14:30:21  Show Profile  Reply with Quote
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

109 Posts

Posted - 05/18/2013 :  08:46:06  Show Profile  Reply with Quote
Thanks Dj.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000