I want to modify table in my production server by extracting some column and put it into another table, the problem is the old column has multiple value separated by commas and in new table will be put in multiple records by query.
i know the way like INSERT INTO user_emails(user_id, email) SELECT id, email FROM users
but it would copy entire content of field.
table users (old)
-----------------------------------------------------
id name emails (removed)
-----------------------------------------------------
1 A aaa@email.com, bbb@email.com
2 B ccc@email.com, ddd@email.com, eee@email.com
table user_emails (new table)
---------------------------------
id user_id email
---------------------------------
1 1 aaa@email.com
2 1 bbb@email.com
3 2 ccc@email.com
4 2 ddd@email.com
5 2 eee@email.com
Any solution? Thank you