select * from tab t1,tab t2 where t1.de=t2.de

解决方案 »

  1.   

    select t1.* from tab t1,tab t2 where t1.de=t2.de and t1.id<>t2.id
      

  2.   

    select * from tab where count(de)>1
      

  3.   

    select * from tab where count(de)>1  group by de
      

  4.   

    to  mickey_uuu() 
    你写的这句好像有问题,会产生好多没有用的数据
      

  5.   

    to iamwls(灵鹤) 
    条件语句count(de)>1  也没法识别to 楼下,我希望先试验成功了,再贴出来,谢谢
      

  6.   

    select a.id,a.de from tab a,tab b
    where a.id!=b.id and a.de=b.de
      

  7.   

    如果要取所有字段的话:
    select a.* from tab a,tab b
    where a.id!=b.id and a.de=b.de
      

  8.   

    感觉以上的方法在表中有大量记录的时候效率不高。我也写了一个,并且调试通过,大家可以讨论讨论。
    select id,de from tab where de in(select de from tab group by de having count(*)>1)
      

  9.   

    select * from tab where de in (select de from tab group by de having count(de)>1)
    go
    试一试
      

  10.   

    建议 soarove(浪迹天涯)给个例子,让俺也来学习学习
      

  11.   

    to kinzey34(无声之舞) 
    你的和mickey_uuu() 应该是一个意思to soarove(浪迹天涯) 
    不好意思,我不知道什么是游标,麻烦您解释一下to oven()、lijiawen(jia) 
     嗯,语句很漂亮不过oven()在先,只好委屈lijiawen(jia) 了
      

  12.   

    select * from tab where de in(select de from tab group by de having count(de)>1)