i have 2 tables in my mysql database and i need to move content from 1 column to another column in a 2nd table where the key is the same.
As the example table 1 (o8hcn_j_content) has a column called jr_businessdescription.
I want to move the entries in this column into a column named fulltext in a 2nd table called (o8hcn_content) The tables don't have entries in teh same order so i want to match this update where the field in the first table (o8hcn_j_content) called contentid matches the id field of table 2.
I've tried lots of ways here are the three I had thought would work but didn't:
UPDATE o8hcn_content SET fulltext = (o8hcn_j_content.jr_businessdescription FROM o8hcn_jreviews_content t2 WHERE o8hcn_j_content.contentid = o8hcn_content.id)
UPDATE o8hcn_content
SET o8hcn_content.fulltext=o8hcn_j_content.jr_businessdescription,
WHERE o8hcn_content.id=o8hcn_j_content.contentid;
UPDATE o8hcn_content
SET o8hcn_content.fulltext=o8hcn_j_content.jr_businessdescription
FROM o8hcn_content
INNER JOIN o8hcn_jreviews_content
ON o8hcn_content.id=o8hcn_j_content.contentid
The correct MySQL syntax is:
UPDATE o8hcn_content JOIN
o8hcn_jreviews_content
ON o8hcn_content.id = o8hcn_j_content.contentid
SET o8hcn_content.fulltext = o8hcn_j_content.jr_businessdescription;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.