select table1.*,table2.除了id列的其他列 into mytemp from table1 left join table2 on table1.id=table2.id

解决方案 »

  1.   

    select table1.*,table2.除了id列的其他列 into mytemp from table1 ,table2 where table1.id=table2.id
      

  2.   

    可以用UNION 来连接两个表,两个表必须为相同的字段
      

  3.   

    用AS给相同的列名给出新列名,ID也只能有一个,把一个ID变成INT型select id,cast(id as int)ID2.....
      

  4.   

    select a.*,b.除了id列的其他列 into mytemp from table1 a left join table2 b on a.id=b.id
      

  5.   

    select * into mytemp from table1(或者table2) where 1=2
    insert into mytemp
    select 除了table1的id列以外的所有列 from table1
    union all
    select 除了table2的id列以外的所有列 from table2
    --这样的结果是mytemp中的ID从table1(或者table2)中的最大ID开始如果想从1开始的话
    1、将你的数据插入一个临时表#temp
    select table1中除了id列 into #temp from table1
    insert into #temp
    select table2中除了id列 from table2
    2、将#temp中的数据查入表mytemp中
    select identity(int,1,1) as id,a.* into mytemp from #temp
      

  6.   

    这样的结果是mytemp中的ID从table1(或者table2)中的最大ID+1开始