kingnutter Posted December 30, 2010 Share Posted December 30, 2010 Hi there, I'm trying to insert multiple values from one table to another along with a few set values. Hopefully you can see what I'm trying to do from the code below. Could anyone tell me the correct syntax? I am doing this through PHPmyadmin. Many thanks in advance. INSERT INTO node (nid, vid, type, language, title, uid, status, created, changed, comment, promote, moderate, sticky, tnid, translate) (SELECT moj_id FROM mojocd, SELECT moj_id FROM mojocd, 'mojocd', 'en', SELECT moj_title FROM mojoocd, 0, 1, 1293671713, 1293671713, 0, 0, 0, 0, 0, 0) Quote Link to comment https://forums.phpfreaks.com/topic/222957-insert-multiple-data-from-one-table-to-another/ Share on other sites More sharing options...
Sock Puppet Posted December 30, 2010 Share Posted December 30, 2010 Your subquery needs to be a valid SQL query in itself. This should probably work for you. INSERT INTO node (nid, vid, type, language, title, uid, status, created, changed, comment, promote, moderate, sticky, tnid, translate) (SELECT moj_id, moj_id, 'mojocd', 'en', moj_title, 0, 1, 1293671713, 1293671713, 0, 0, 0, 0, 0, 0 FROM mojocd) Quote Link to comment https://forums.phpfreaks.com/topic/222957-insert-multiple-data-from-one-table-to-another/#findComment-1152847 Share on other sites More sharing options...
kingnutter Posted December 30, 2010 Author Share Posted December 30, 2010 Thanks. That works perfectly and I will refer to this syntax on all my future similar queries. Quote Link to comment https://forums.phpfreaks.com/topic/222957-insert-multiple-data-from-one-table-to-another/#findComment-1152938 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.