先用UNION把结果连在一起存到临时表
再distinct去重复项

解决方案 »

  1.   

    楼上正解,具体如下
    Select distinct [A] from (SELECT [A] FROM [ypdebt] union SELECT [A] FROM [spdebt]) #temp1
      

  2.   

    select * into new from (select * from ypdebt union select * from spdebt) #temp1
      

  3.   

    select [A] FROM [ypdebt]   
    union   
    SELECT   [A]   FROM   [spdebt]
    在默认情况下,union运算符将从结果集中删除重复的行,如果使用ALL关键字,那么结果中将包含所有行而不删除重复行
      

  4.   

    SELECT A FROM 表1
    UNION
    SELECT A FROM 表2UNION 会自动去除重复的
      

  5.   


    select A from 表1
    union
    select B from 表2
      

  6.   

    1
    [code=MSIL]select distinct 字段 from
    (
    select A from 表1
    union all
    select B from 表2
    )[/code]2
    [code=MSIL]select * into #t from A where 1=1
    insert into #t select from A
    insert into #t select from Bselect distinct 字段 from #t[/code]