mysql insert data from multiple select queries

Posted by daulex on Stack Overflow See other posts from Stack Overflow or by daulex
Published on 2010-04-01T12:01:08Z Indexed on 2010/04/01 12:03 UTC
Read the original article Hit count: 264

Filed under:
|
|

What I've got working and it's what I need to improve on:

INSERT form_data (id,data_id, email) SELECT fk_form_joiner_id AS data_id, value AS email FROM wp_contactform_submit_data WHERE form_key='your-email'

This just gets the emails, now this is great, but not enough as I have a good few different values of form_key that I need to import into different columns, I'm aware that I can do it via php using foreach loops and updates, but this needs to be done purely in mysql.

So how do I do something like: insert form_data(id,data,email,name,surname,etc) Select [..],Select [..]....

Please help

© Stack Overflow or respective owner

Related posts about mysql

Related posts about myisam