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
 General SQL Server Forums
 New to SQL Server Programming
 Update inner join column

Author  Topic 

peace
Constraint Violating Yak Guru

420 Posts

Posted - 2012-03-23 : 03:06:05
Can I actually update from inner join table column?

Update tableA
set tableB.Name = ''
inner join tableB on...
where...

Is this correct?

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-03-23 : 03:11:49
[code]
update A
set A.Name = ''
from tableA A inner join tableB B on . . .
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

peace
Constraint Violating Yak Guru

420 Posts

Posted - 2012-03-23 : 03:25:24
i actually has another left join

Update tableA
set tableC.country = ''
inner join tableB on...
left join tableC on tableB...=tableC...
where...

but i get this error
The multi-part identifier "tableC.country" could not be bound.

what it meant?
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-03-23 : 03:27:17
if you want to update tablec, then the statement should be

update tablec
set tablec.country = ''



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -