日期:2014-05-18 浏览次数:20421 次
--显示所有不相等的数据 select a.* from a,b where a.name1<>b.name1 or a.sex1<>b.sex1 or a.id2<>b.id2 or a.name2<>b.name2 or a.sex2<>b.sex2 or a.id3<>b.id3 or a.name3<>b.nam3 or a.sex3<>b.sex3 union --连接显示所有相等的数据 select a.* from a,b where a.name1=b.name1 and a.sex1=b.sex1 and a.id2=b.id2 and a.name2=b.name2 and a.sex2=b.sex2 and a.id3=b.id3 and a.name3=b.nam3 and a.sex3=b.sex3
------解决方案--------------------
select * from a union select * from b
------解决方案--------------------
SELECT DISTINCT * from ( select * from a union select * from b )