[英]Get columns from one table to another
So I'll create a combination of all first names and all surnames from a table (Person). 因此,我将创建一个表(人)中所有名字和所有姓氏的组合。
insert into tabell_med_navn
select f.fornavn, e.etternavn
from person f cross join person e
These combinations should then be added to a table I have made earlier. 然后将这些组合添加到我之前创建的表中。
create table tabell_med_navn (
id int not null auto_increment,
fornavn varchar(40) null,
etternavn varchar(40) null,
primary key (id)
);
It is when I am trying to send the combination over it fails. 当我尝试通过其发送组合失败时。 Anybody know why it fails? 有人知道为什么失败吗?
List the columns being inserted: 列出要插入的列:
insert into tabell_med_navn (fornavn, etternavn)
select f.fornavn, e.etternavn
from person f cross join
person e;
This will assign a default value to the id column. 这将为id列分配一个默认值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.