I am populating a new table from another two tables. But I also try to use the just inserted entity ID to link it with one of the tables.
I successfully get the inserted entity ID like this:
INSERT INTO EngagementOverview (AccountingFirmId, AccountingFirmClientId, CompanyName, YearEnd, YearStart, AccountingFirmOfficeId)
OUTPUT inserted.id
SELECT Engagement.AccountingFirmId, Engagement.AccountingFirmClientId, CompanyName, YearEnd, YearStart, AccountingFirmOfficeId
FROM Engagement
INNER JOIN EngagementHeader ON Engagement.EngagementHeaderId = EngagementHeader.Id
How could I use that in UPDATE statement to update EngagementHeader table's field?