Jump to content

Insert Multiple with Where Clause


siamiam

Recommended Posts

I'm using mySQL 5.5.9 and I'm attempting to insert data from one table into another.

 

I have two tables, they both contain a column named 'chargify_id'.

 

I need to copy the chargify_id from table1 into table2 for each entry where the user IDs match (user_id and ID)

 

INSERT INTO table2 (chargify_id)
SELECT chargify_id
FROM table1
WHERE table1.user_id = table2.ID

 

I feel like I'm close, but perhaps not.

 

 

Link to comment
https://forums.phpfreaks.com/topic/252625-insert-multiple-with-where-clause/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.