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.字段);
补充,第二个语句也应该加distinct,如下: select distinct 字段 from A union select distinct 字段 from b where not exists (select 字段 from a where a.字段=b.字段);
); 或
select distinct 字段 from A union
select 字段 from b where not exists (select 字段 from a where a.字段=b.字段);
select distinct 字段 from A union
select distinct 字段 from b where not exists (select 字段 from a where a.字段=b.字段);