select yppm,ypspm,hldw,ypjx from YP_YPGGD a 
where exists(select yppm,YPSPM,hldw,ypjx from YP_YPGGD where yppm=a.yppm and ypspm=a.ypspm  and hldw=a.hldw and ypjx=a.ypjx )
    
  怎样找出数据一样的数据!
    上下对比!

解决方案 »

  1.   

    select yppm,ypspm,hldw,ypjx from YP_YPGGD a 
    where exists(select yppm,YPSPM,hldw,ypjx from YP_YPGGD where yppm=a.yppm and ypspm=a.ypspm  and hldw=a.hldw and ypjx=a.ypjx ) 可能全部出来了,
    再加一列比较的
      

  2.   

    select yppm,ypspm,hldw,ypjx from YP_YPGGD a 
    where exists(select 1 from YP_YPGGD where yppm=a.yppm and ypspm=a.ypspm  and hldw=a.hldw and ypjx=a.ypjx and ID<>a.ID
      

  3.   

    那用GROUP BY HAVING COUNT(*)>=2