INSERT INTO tb_month_report_chapter_main VALUES(null, '2016-11',5); INSERT INTO tb_month_report_chapter_text (main_id, chapter,text_type, text_content) VALUES (( SELECT id FROM tb_month_report_chapter_main WHERE record_month='2016-11' AND customer_id=5 ), '1.2.3','advice','123') ;