Avatar of Bobby
Bobby
Flag for United States of America asked on

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.
MySQL ServerSQL

Avatar of undefined
Last Comment
Bobby

8/22/2022 - Mon
Scott Pletcher

UPDATE e
SET content = e2.content
FROM dbo.entries e
INNER JOIN dbo.entries2 e2 ON e2.id = e.id
Bobby

ASKER
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
Scott Pletcher

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.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
ASKER CERTIFIED SOLUTION
Bobby

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Bobby

ASKER
I also should have pointed out MySQL at first. Sorry about that.