[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 288
  • Last Modified:

Update all records in one column with data from the first record in another table

I am  looking to update all the rows of one column in a table with the value in a the first row in a seperate table.
I have tried
UPDATE       InputGlobalFeed
SET                IGFMerchantName = AWHeader.AWMerchantName
FROM            AWHeader CROSS JOIN

But this updates IGFMerchantName from  InputGlobalFeed with various record from AWHeader and not just AWMerchantName.
Many thanks
Simon Cripps
Simon Cripps
1 Solution
Try this query

UPDATE InputGlobalFeed
SET IGFMerchantName = (SELECT TOP 1 AWMerchantName FROM AWHeader)
try this
SET T1.IGFMerchantName = T2.AWMerchantName
FROM InputGlobalFeed T1,
	(SELECT TOP 1 AWMerchantName FROM AWHeader) T2

Open in new window

Simon CrippsAuthor Commented:
many thanks Sunithnair, thought it was something like this but just could not nail it. Cheers

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now