mysql - Inserting values from 1 table to another error -
i'm having 2 tables modules_templates and templates in table templates have 75 records . want insert table modules_templates data template_id in modules_templates = template_id templates. created query : insert `modules_templates` (`module_template_id`,`module_template_modified`,`module_id`,`template_id`) values ('','2014-04-14 10:07:03','300',(select template_id templates 1)) and i'm having error #1242 - subquery returns more 1 row , how add 75 rows in 1 query ? try this insert `modules_templates` (`module_template_id`,`module_template_modified`,`module_id`,`template_id`) (select '','2014-04-14 10:07:03','300',template_id templates 1) your query didn't work because inserting value 1 row, last field i.e result of sub query multirow, had put single row values in sub-query returned each row in sub query.