第一条语句不加distinct我测试时和加是一样的。
第三种方法太复杂了,可简化如下:
select a.* from u_db a where idno+idtype in(select idno+idtype
from u_db group by idno,idtype having count(*) > 1  )

解决方案 »

  1.   

    当重复的记录为三条时就会出现六条的,也是无意用笔在纸上排列了一下笛卡尔积是九个有三个互相重的除去了:)
    (3)查询三中最终的条件语句中为什么会是where a.idno = b.idno and  a.idtype = b.idtype  
     中实际想问的是如果是b.idno = a.idno and b.idtype = a.idtype是否可以
      

  2.   

    a和b的先后顺序没有关系吧!b.idno = a.idno and b.idtype = a.idtype和a.idno = b.idno and  a.idtype = b.idtype 应该一样!
      

  3.   

    楼主的意思是否:
    1.找出idtype + idno的重复组合.
    2.iden可以唯一的标识一行.--第三种思路也可以这样写
    select a.* 
    from u_db a,
    (select idtype, idno from u_db group by idtype, idno having count(*) > 1) b
    where a.idtype = b.idtype
    and a.idno = b.idno