我想将值从表添加到另一个,但在第一个表中我有外键 如何插入它的值?
insert into student(first_name)
select * from `TABLE 13`
set school_id = 1
school_id是如何将其值设置为1
的forign键答案 0 :(得分:0)
你的意思是这样的:
insert into student(first_name)
VALUES( select first_name from `TABLE 13` WHERE school_id = 1 LIMIT 1 )
答案 1 :(得分:0)
尝试这样的事情:
INSERT INTO student(first_name,school_id)
SELECT first_name, 1 FROM `TABLE 13`