mysql - How to insert multiple rows at once using INSERT INTO query -
so here problem, want insert data table (webform_submitted_data) anather table (feedback_analysis) data want copy 1 nid=20 , cid= 3,4,5 table this,
so here doing,
insert feedback_analysis (service,type,feedback) values ((select data webform_submitted_data nid=20 , cid=5),(select data webform_submitted_data nid=20 , cid=3),(select data webform_submitted_data nid=20 , cid=4)); but i'm getting error error 1242 (21000): subquery returns more 1 row
i got reason behind that, subquery returning 2 rows in result single insert into query can not handle.
i want insert all rows in table, can process further
so please me find solution this.
i want apply trigger directly insert values feedback_analysis table once new value of nid=20 inserted table of weform_submitted_data
thank you.
you can use limit 1
insert feedback_analysis (service,type,feedback) values ((select data webform_submitted_data nid=20 , cid=5 limit 1), (select data webform_submitted_data nid=20 , cid=3 limit 1), (select data webform_submitted_data nid=20 , cid=4 limit 1));
Comments
Post a Comment