17

I have a table that I just added a column to and now I am trying to find an easy way to update it.

select * from KioskGoals kg
inner join [TestDB].dbo.Kiosks k on kg.kioskID = k.Id

The joined table has the names I need. I want to update KioskGoals table and set the kioskName column = to the name returned from [TestDB].dbo.Kiosks which would be k.name

Is this possible with a single query?

The table that needs to be updated is KioskGoals. The column that needs to be updated is kioskName.

James Wilson
  • 4,966
  • 15
  • 60
  • 118

1 Answers1

10
UPDATE kg
 SET Kg.kioskName =  K.name
from KioskGoals kg inner join [TestDB].dbo.Kiosks k 
on kg.kioskID = k.Id
M.Ali
  • 65,124
  • 12
  • 92
  • 119