0

I am using Sequel Pro to copy data from an old database to a new one. I know you can select rows and copy them as an SQL INSERT etc. But the layout for my new data base has changed and I no longer want to copy all the data in the rows. I just need to be able to get specific columns. I know I could copy all the rows then cut the parts I don't want out, but that would be a lot of work as I'm working with a lot of data. Surely there's something I can run to do this?

Here's what I want to be able to do. I have both the old database and the new one uploaded to my website so I can access them both through Sequel Pro. My old database is called old_db and the new one is called wordpress.

I need to be able to select the wp_users table inside old_db and select the following columns, ID, user_login, user_pass etc. and copy them into the wp_users table inside my new database wordpress.

Pawan Tiwari
  • 518
  • 6
  • 26
Reece
  • 2,581
  • 10
  • 42
  • 90
  • Why not just something like `SELECT yourSpecificColumn ....` or did I fail to understand your request? – B001ᛦ Apr 30 '19 at 09:20
  • @B001ᛦ I would if I knew how haha. If you could either show me an example of how to do this or link me to the information that I need I'd appreciate it. Thanks – Reece Apr 30 '19 at 09:22
  • _link me to the information..._ [This](https://dev.mysql.com/doc/refman/5.5/en/insert-select.html) might help you – B001ᛦ Apr 30 '19 at 09:24

1 Answers1

-1

I managed to do this with the following in MySQL

INSERT INTO wordpress.wp_users (ID, user_login, user_pass, user_nicename, user_email, user_registered, user_activation_key, user_status, display_name) SELECT ID, user_login FROM old_db.wp_users;
Reece
  • 2,581
  • 10
  • 42
  • 90