Insert value Into TableA From TableB Where multiple fields match in both

Hopefully the title sums it up but:

Hello,

I'm working in SQL Server 2008.  

I need to get the value from col1 in Table_A and insert it into col1 in Table_B where Table_A.col2 = Table_B.col2, and TableA.col3 = Table_B.col3, and Table_A.col4 = TableB.col4

The relationship is one to many Table_A to Table_B.

Hopefully that makes enough sense.  

Thanks in advance!!!
LVL 1
ttist25Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
This is not an INSERT, it's an UPDATE. It's almost like your description:

 
UPDATE  B
SET     col1 = A.col1
FROM    Table_A A
        INNER JOIN Table_B B ON A.col2 = B.col2
                                AND A.col3 = B.col3
                                AND A.col4 = B.col4;

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ttist25Author Commented:
Worked a treat!  Thank you sir!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.