update a table from another table

I have a table named entries. I have another table named entries2. In each table there is an id column and a content column. I need to replace all the content in table entries with all the content from table entries2. They tie together by column id.
LVL 1
BobbyAsked:
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.

Scott PletcherSenior DBACommented:
UPDATE e
SET content = e2.content
FROM dbo.entries e
INNER JOIN dbo.entries2 e2 ON e2.id = e.id
0
BobbyAuthor Commented:
In SQLyog I get an error with that (I put the actual names in, you'll see that difference, was trying to keep it simple before)...

1 queries executed, 0 success, 1 errors, 0 warnings

Query: UPDATE e SET body = e2.body FROM dbo.bolt_entries e INNER JOIN dbo.bolt_entries2 e2 ON e2.id = e.id

Error Code: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM dbo.bolt_entries e
INNER JOIN dbo.bolt_entries2 e2 ON e2.id = e.id' at line 3
0
Scott PletcherSenior DBACommented:
Sorry, I used SQL Server syntax, by habit I assumed that.

I'm not sure how to do that in MySQL.  Hopefully someone else can help.
0
BobbyAuthor Commented:
I figured it out...

UPDATE bolt_entries
INNER JOIN bolt_entries2 ON bolt_entries.id = bolt_entries2.id
SET bolt_entries.body = bolt_entries2.body;

Thanks for your help though.
1

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
BobbyAuthor Commented:
I also should have pointed out MySQL at first. Sorry about that.
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
Query Syntax

From novice to tech pro — start learning today.