--用union all或union,前者不合并重复行,后者合并重复行select * from 表a
union all
select * from 表b

解决方案 »

  1.   

    select * from A
    Union all
    select * from B
      

  2.   

    表1 :                          表2: 
            id      name                id      name
            ------------                ------------
            1       liu                 1       wangselect * from 表1 inner join 表2  on 表1.id = 表2.id 
    where 表1.name <> 表2.name 
    结果集为 : 
             id     name    id   name
             ------------------------
             1       liu     1    wang
    想要的结果集为
             id      name 
             ------------
             1        liu
             1        wang
      

  3.   

    我的要求是有相同的数据完全过滤掉 
    要是用 union or ouion all的话
    即使有完全相同的数据 还是会显示出来一条
      

  4.   

    表1 :                          表2: 
            id      name                id      name
            ------------                ------------
            1       liu                 1       wang
            2       sun                 2       sun
    select * from 表1 inner join 表2  on 表1.id = 表2.id 
    where 表1.name <> 表2.name 
    结果集为 : 
             id     name    id   name
             ------------------------
             1       liu     1    wang
    想要的结果集为
             id      name 
             ------------
             1        liu
             1        wang
      

  5.   

    select * from A
    Union all
    select * from B
    如果这个不能满足楼主的要求的话,楼主显然没有把问题说清楚