select distinct(fieldname) from tablename

解决方案 »

  1.   

    SELECT TOP 5 *
    FROM table_name 
    WHERE (select COUNT(field2) from table_name)>1
      

  2.   

    Select * from 表,(select 字段1 As AAA,count(字段1) As Num From 表 Group By 字段1) W Where 字段1=AAA And Num>1
      

  3.   

    请测试一下好吗?
    (select COUNT(field2) from table_name)>1
    只要数据库中有数据就会成立。
    我说的显示前五行,是只在本例中、是指显示重复的行。
      

  4.   

    Fanks(凡可) 的代码是可以通过的。SELECT Src.* 
    FROM 表名 Src
    JOIN (SELECT 字段1,COUNT(字段1) AC Cnt 
          FROM 表名 
          GROUP BY 字段1) Tmp
    ON Tmp.字段1=Src.字段1
    WHERE Tmp.Cnt>1
      

  5.   

    select * 
    from tableName
    where fld2 in 
         (select fld2 
          from tableName 
          where (select Count(fld2) from tableName)>=2)
      

  6.   

    select * 
    from tableName as a
    where fld2 in 
         (select fld2 
          from tableName as b
          where (select Count(fld2) from tableName as c where c.fld2=b.fld2)>=2)
    尚末測試
      

  7.   

    我是在测试之后才回复的。显示数据为:1   aaa  asdfasdfg
    2   aaa   pojlk;klk
    3   aaa  lkjlk;jlk
    4   bbb  aldksj;
    5   bbb  asdfas这不是你想要的结果?
    或者你还有其他的条件限制?!
      

  8.   

    select * from table1 where field2 in (select field2 from table1 group by field2 haing count(b)>1)
      

  9.   

    select a.field1,a.field2,a.field3 from table1 a  inner join (select field2 from table1 group by field2 having count(*)>1) b on a.field2=b.field2
      

  10.   

    丢了一个字母:
    select * from table1 where field2 in (select field2 from table1 group by field2 having count(b)>1)经过测试的。
      

  11.   

    這兩种方法經過測試都是可以的
    ---------sindyzhou
    select * 
    from tableName as a
    where fld2 in 
         (select fld2 
          from tableName as b
          where (select Count(fld2) from tableName as c where c.fld2=b.fld2)>=2)
    --------of123() 
    select * from table1 where field2 in (select field2 from table1 group by field2 haing count(b)>1)
      

  12.   

    select * from table1 where field2 in ( select field2 from table1 group by field2 having count(field2)>1)
      

  13.   

    建议数据库查询可以不用In语句的时候尽量不用In语句。