Parth Bakshi
Parth Bakshi

Reputation: 85

Merge the result of an Inner Join to a table SQL

Using SQL query I have a successfully result used an inner join, but the results are displayed underneath the query.

How can I jot the results down in an already existing table ie merge with it?

UPDATE CuringHistoryData.dbo.CuringData
SET PressNumber = master.dbo.TagTable
WHERE CuringHistoryData.dbo.CuringData.TagIndex = master.dbo.TagTable.TagIndex;

When I execute this I get an error

Msg 4104, Level 16, State 1, Line 11
The multi-part identifier "master.dbo.TagTable.TagIndex" could not be bound.

Dont know where am I going wrong. Both the tables exist by the way.

Upvotes: 1

Views: 69

Answers (1)

Madhivanan
Madhivanan

Reputation: 13700

 UPDATE t1 
    SET t1.PressNumber = t2.pressnumber 
from CuringHistoryData.dbo.CuringData as t1 inner join  master.dbo.TagTable as t2 on
t1.TagIndex = t2.TagIndex;

Upvotes: 1

Related Questions