当前位置: 代码迷 >> Sql Server >> 如何将一个表的一列数据插入到另一表中!
  详细解决方案

如何将一个表的一列数据插入到另一表中!

热度:197   发布时间:2016-04-27 14:09:39.0
怎么将一个表的一列数据插入到另一表中!!!
 
  science 表
  name count other
  a1 5 aa1
  a2 6 aa2


  super 表 
  name sey 
  b1 5
  b2 6



如何将 super表的那么字段所有值插入至science表。

插入后结果
  science 表
  name count other
  a1 5 aa1
  a2 6 aa2
  b1  
  b2

------解决方案--------------------
SQL code
declare @science table (name varchar(2),[count] int,other varchar(3))insert into @scienceselect 'a1',5,'aa1' union allselect 'a2',6,'aa2'declare @super table (name varchar(2),sey int)insert into @superselect 'b1',5 union allselect 'b2',6insert into @science(name) select name from @superselect * from @science/*name count       other---- ----------- -----a1   5           aa1a2   6           aa2b1   NULL        NULLb2   NULL        NULL*/
  相关解决方案