t1表字段:
name age school country现在我想插入一些数据
插入每行纪录来源为:name和age的值来自另一个表t2,school和country则都是插入固定值‘第一中学’和‘中国’最后实现:
name age school country
t2.name t2.age 第一中学 中国
......
......我想让‘第一中学’和‘中国’随着插入每行记录时才产生,请教怎么写这样的SQL语句?我用insert into t1(name,age) select name,age from t2,但是后面两个字段固定值值不能在同一条语句里完插入。
name age school country现在我想插入一些数据
插入每行纪录来源为:name和age的值来自另一个表t2,school和country则都是插入固定值‘第一中学’和‘中国’最后实现:
name age school country
t2.name t2.age 第一中学 中国
......
......我想让‘第一中学’和‘中国’随着插入每行记录时才产生,请教怎么写这样的SQL语句?我用insert into t1(name,age) select name,age from t2,但是后面两个字段固定值值不能在同一条语句里完插入。
from t2
select name,age,' 第一中学', '中国'
from t2