我想将表中的值添加到另一个表中,但是在第一个表中我有外键如何插入它的值?
insert into student(first_name)
select * from `TABLE 13`
set school_id = 1
school_id 是外键如何将其值设置为 1
Do you mean something like this:
insert into student(first_name)
VALUES( select first_name from `TABLE 13` WHERE school_id = 1 LIMIT 1 )
Try something like this:
INSERT INTO student(first_name,school_id)
SELECT first_name, 1 FROM `TABLE 13`