如何将附加列和值添加到MySQL查询INSERT SELECT

Hi I have 2 columns tbl_feestudent and tbl_feeschool and this is their columns

feestudent_id, student_id, schoolyear_id, gradelevel_id, feetype_id, and feestudent_amount.

feeschool_id, schoolyear_id, gradelevel_id, feetype_id, and feeschool_amount.

I'm using a MySQL Query of INSERT SELECT where all the items that selected in tbl_feeschool will be inserted in tbl_feestudent

tbl_feestudent however has additional column which is student_id

How would I insert a value of student_id to all inserted values coming from tbl_feeschool

Let's just say the value of student_id is 40, the table would like like this.

enter image description here

As of now this is my query of INSERT SELECT with WHERE schoolyear_id = 4 and gradelevel_id = 1.

INSERT INTO tbl_feestudent (schoolyear_id, gradelevel_id, feetype_id, feestudent_amount) 
SELECT schoolyear_id, gradelevel_id, feetype_id, feeschool_amount 
FROM tbl_feeschool 
WHERE schoolyear_id = 4 AND gradelevel_id = 1

Add id to your select query suppose your student_id is 40 then

INSERT INTO tbl_feestudent (student_id,schoolyear_id, gradelevel_id, feetype_id, feestudent_amount) 
SELECT 40,schoolyear_id, gradelevel_id, feetype_id, feeschool_amount 
FROM tbl_feeschool 
WHERE schoolyear_id = 4 AND gradelevel_id = 1