select 字段 from A union select 字段 from B

解决方案 »

  1.   

    select distinct * from (select 字段 from A union select 字段 from B
    ); 或
    select distinct 字段 from A union 
    select 字段 from b where not exists (select 字段 from a where a.字段=b.字段);
      

  2.   

    补充,第二个语句也应该加distinct,如下:
    select distinct 字段 from A union 
    select distinct 字段 from b where not exists (select 字段 from a where a.字段=b.字段);
      

  3.   

    to qiuyang_wang(小数点) :我测过,不需要distinct