我想在表中筛选出假重复的数据  (有主键,某两列数据重复的行即为重复数据)
这个语句该怎么写啊 !各位大侠帮帮忙 头疼中!!!!

解决方案 »

  1.   

    固定两列的判断
    select distinct col1,col2 from  tab
    还是指3列中任意两列...?
      

  2.   

    固定两列的判断
    select distinct col1,col2 from tabCOL1,COL2替换成你的列就可以了
      

  3.   

    select col1,col2 ,count(*) from tab group by col1,col2 having count(*)>1这就找出重复的行。
      

  4.   

    select t.col1,t.col2 , t.col3  from table t 
    left join (select col1, col2,max(pre_key) as key from table group by col1,col2) d 
    on t.pre_key=d.key  
    where t.col3 is null  ;
    pre_key --主键查询结果 就是重复的数据