Replace data in MySQL table with data from another table
Posted
by Oli
on Stack Overflow
See other posts from Stack Overflow
or by Oli
Published on 2010-04-04T22:26:35Z
Indexed on
2010/04/04
22:33 UTC
Read the original article
Hit count: 139
I am trying to modify an existing MySQL database for use in a new application. I have a table of items (table_items), which has multiple fields, including "ItemID" and "ItemName". I have another table (table_list) which has "ItemName" in it, but no ItemID. I need to either update this table to contain ItemID instead of ItemName, or create a new table which imports ItemIDs from table_items as opposed to the ItemName when table_list.ItemName = table_items.ItemName.
I have tried the following: UPDATE table_list A, table_items B SET A.ItemName = B.ItemID WHERE A.ItemName = B.ItemName
The current table has over 500,000 rows and every time i try this in PHPMyAdmin i get the error "the MySQl server has gone away".
Any help greatly appreciated.
© Stack Overflow or respective owner