这样也能就是不行的你可以创建视图
create view test as
select id1 from mytable
union 
select id2 from mytable
union 
select id3 from mytable
go
insert into .....select * from test
go

解决方案 »

  1.   

    insert #temp select id1 from mytable
    go
    insert #temp select id2 from mytable
    go
    insert #temp select id3 from mytable
    go
    insert sa select * from #temp
    go
      

  2.   

    insert into sa 
    select * from 
    (
    select id1 from mytable
    union 
    select id2 from mytable
    union 
    select id3 from mytable
    )
    AAA
      

  3.   

    揭贴
    I made a mistake just now.in fact the sql statements:
    insert  into sa 
    select id1 from mytable
    union all
    select id2 from mytable
    union all
    select id3 from mytable
    能够使用union,只是我开始的时候忘了加all,导致相同的结果只出现一次。
    谢谢四位大哥。