Reputation: 4662
I'm probably overthinking this so here goes.
I have two tables. The first one I want to populate the CorporationId based off it's TokenId value.
dbo.UsersAccountLink:
And the table that I want to get the value from:
Company.Token:
Here is what I have but it's not set right so it will not run. I'm not sure how to do this:
INSERT INTO dbo.UsersAccountLink.CorporationId
Select CorporationId
From Company.Token
Where Company.Token.TokenId = dbo.UsersAccountLink.TokenId
I want to populate dbo.UsersAccountLink.CorporationId with the value in Company.Token.CorporationId based on the TokenId.
Help?!
Upvotes: 3
Views: 4251
Reputation: 25152
Looks like you want to update versus insert...
update dbo.UsersAccountLink
set CorporationID =
(Select CorporationId
From Company.Token
Where Company.Token.TokenId = dbo.UsersAccountLink.TokenId)
Upvotes: 4