檢查select Sum(name) from test 
與 select sum(DISTINCT name) from test 
的返回值是否相等。

解决方案 »

  1.   

    首先感谢您的回答!
     
    但是您的回答并不是我想的!
    我的意思是:我想把NAME有重复值的记录查出来,而没有重复的不显示,
      

  2.   

    select *
        from test
        where name in (
               select name
                   from test
                   group by name
                   having count(*)>1
               )
      

  3.   

    select distinct * from test a 
    where (select count(*) from test b where a.name=b.name ) >1
      

  4.   

    select name
     from tableneme
     where name is not null
     group by name
     having count(*) > 1
    如果想显示所有字段,就用上段sql在作为自查询结果就行了。
      

  5.   

      select distinct A.name from test A,test B where (A.name = B.name and A.ID <> B.id) 
      

  6.   

    这个嘛,一定要用到Having子句,下面这句包你满意!
      select Name from test
        group by Name
        having count(*)>1 
    或:
     select * from test
        where Name in (select Name from test group by Name having count(*)>1)
      

  7.   

    这个嘛,一定要用到having子句,下面这两个包您满意:
      select name from test group by name having count(*)>1
      
      select * from test
      where name in (select name from test group by name having count(*)>1)
      

  8.   

    这个SQL 找出所有重复的NAME:
      SELECT name FROM test GROUP BY name HAVING (COUNT(name) > 1)如果要找出所有重复的记录,需要用子查询:
    SELECT * FROM test 
      WHERE (name IN
              (SELECT name FROM tab_test GROUP BY name HAVING (COUNT(name) > 1))
            )
      

  9.   

    这个SQL 找出所有重复的NAME:
      SELECT name FROM test GROUP BY name HAVING (COUNT(name) > 1)如果要找出所有重复的记录,需要用子查询:
    SELECT * FROM test 
      WHERE (name IN
              (SELECT name FROM test GROUP BY name HAVING (COUNT(name) > 1))
            )
      

  10.   

    忠心感谢大家!
    热泪盈眶!
    大家的回答我都实验过,全都好使;
    除了"lyxinfo"略有小疑,
    再次感谢!