suppose I have a users table but with different structure, how could I import all the data into another one?
lets say I have:
users:
- id
- name
- created_at
- updated_at
and another one already populated with:
users:
- id
- login
- created_at
- updated_at
its just a s开发者_Python百科ample to easy visualization.
Any help is appreciated!
Take a look at insert into select
http://dev.mysql.com/doc/refman/5.0/en/insert-select.html
INSERT INTO users2
(LOGIN,
created_at,
updated_at)
SELECT name,
created_at,
updated_at
FROM users1
精彩评论