November 6th, 2013, 11:34 AM
Two identical mysql tables, one is empty, how to populate it?
I have one table full of data (imagine 10,000 values)
ID | name | e-mail (only as example)
1 |alfaa | e-mail alfaa 1
2 |alfaa | e-mail alfaa 2
3 |beta | e-mail beta
4 |celta |e-mail celta
and other identical table with the "e-mail" column empty, and some names that are also contained in table_1, alltough with a different ID
=> table_2 (with 6,000 values)
ID | name | e-mail
1 |beta |
2 |alfaa |
3 |celta |
My question is, how can I populate the empty e-mail column of table_2 with values from e-mail column of table_1 WHERE table_2.name = table_1.name ?
The IDs are different AND table_1 contains some cases of several e-mails for the same name.
(well, I also could handle to work without several e-mails for the same name)
Last edited by Vega5; November 6th, 2013 at 12:38 PM.
November 7th, 2013, 02:40 PM
Make a php file with simple code, and you can make that easily.
November 7th, 2013, 03:30 PM
this is supremely unhelpful
Originally Posted by webup247biz
November 7th, 2013, 03:32 PM
If you want I can make you the code, just send me the database I even make the changes between them. Just say
Originally Posted by r937
November 7th, 2013, 04:44 PM
I found the solution
Thanks, I found the solution for this:
UPDATE table_2, table_1
SET table_2.`e-mail` = table_1.`e-mail`
WHERE table_1.`name` = table_2.`name`;