This is a discussion on database schema migration within the MySQL General forum forums, part of the MySQL category; --> hey all, I have two tables like that: artists(id,name) albums(id,artist_id,album_name) and I need to transfer the data of this ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| hey all, I have two tables like that: artists(id,name) albums(id,artist_id,album_name) and I need to transfer the data of this database to three tables that look like this: artists(id,name) albums(id,name) artists_albums(album_id,artist_id) any idea what's the fastest query to do this? thanx in advance Pat |
| ||||
| Patrick Aljord wrote: > hey all, > I have two tables like that: > artists(id,name) > albums(id,artist_id,album_name) > > and I need to transfer the data of this database to three tables that > look like this: > artists(id,name) > albums(id,name) > artists_albums(album_id,artist_id) > > any idea what's the fastest query to do this? insert into artists_albums(album_id, artist_id) select id, artist_id from albums; |