SQL Query: Writing update statement in a new way – Matthew Jeffries

UPDATE [ED] SET [ED].[NNumber] = [P].[NNumber]

FROM #El AS [ED]

OUTER APPLY

(

SELECT TOP 1 [N].[NNumber]

FROM [In].[temp].[NumberMAP] AS [SK]

INNER JOIN [In].[temp].[NumberMap2] AS [N]

ON [SK].GUID_ID=[N].GUID_ID

WHERE [SK].[PID] = [ED].[PID]

) AS [P];

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s