怎样才能把某一字段中值相等的数据全部选取出来有一个表web,其中有一个varchar类型webadd字段,怎样才能把webadd字段中值相同的数据选取出来呢?(也就是说,怎样才能把webadd字段中值相等的数据全部选取出来)

解决方案 »

  1.   

    假设id主键
    select id from web group by webadd
      

  2.   

    select webadd 
    from tablename
    group by webadd
    having count(1) > 1
      

  3.   

    上面错了。
    假设id主键
    select a.id,a.webadd from web a inner join  web b on a.webadd=b.webadd and a.id<>b.id
      

  4.   

    select * from tb where webadd in (select webadd from tb group by webadd having count(*) > 1)
      

  5.   

    可以这样:
      select distinct webadd,count(webadd) as Expr1 from Web   
      group by webadd having count(webadd)>1
      

  6.   

    同意dawugui(潇洒老乌龟)兄的 :)
      

  7.   

    select webadd,count(webadd) as 重复次数 from web group by webadd having count(webadd)>1