请教一个关于从一个表查数据插入到另一个表的中sql语句的写法?? 有2个表,t1,t2,我想从t2中查找col1和col2的数据插入到t1对应的两列中,但还要同时插入几个固定的数值也就是 t1中有5列,从t2中只查询2列,其余的三列用固定的数据 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 insert into t1select t2.a,t2.b,1,2,'aaa' from t2 insert t1 select @val1,@val2,@val3,col1,col2 from t2 --位置自己定 insert into t1 select t2.cola,t2.colb,1,2,3 from t2 insert into t1select t2.a,t2.b,1,2,'aaa' from t2 insert into t1select col1,col2,固定数据1,固定数据2,固定数据3 from t1 insert into t1(col1,col2,col3,col4,col5)select col1,col2,'固定数值1' as col3,'固定数值2' as col4,'固定数值3' as col5 from t2 select col1,col2,col3='固定值3',col4='固定值4',col5='固定值5' into t2 from t1试看 insert into table1(col1,col2) select col3,col4 from table2 mysql ERROR 2003 帮忙写个语句,谢谢。 怎样随机更新记录 求助,这样的sql语句该怎么写 大量的文本文件导入到SQLServer2000中 存储过程里的'set nocount on'是什么意思? 一段动态SQL,我有点不懂。 操作系统WIN2000,SQLSERVER7,计算机名称改变后,SQLSERVER不能启动,请问如何解决 不通过查询分析器,自己编段小程序来执行*.sql文件 随机抽样问题,大伙帮帮忙好吗? sql 存储过程问题 创建视图
select t2.a,t2.b,1,2,'aaa' from t2
insert t1 select @val1,@val2,@val3,col1,col2 from t2 --位置自己定
select t2.cola,t2.colb,1,2,3 from t2
select t2.a,t2.b,1,2,'aaa' from t2
select col1,col2,固定数据1,固定数据2,固定数据3 from t1
select col1,col2,'固定数值1' as col3,'固定数值2' as col4,'固定数值3' as col5 from t2
select col1,col2,col3='固定值3',col4='固定值4',col5='固定值5' into t2 from t1试看