比如tb1有一个字段email,如何选出这个字段里包含相同email的记录。不重复则不选出。有正确的即结贴,谢谢

解决方案 »

  1.   


    select [email],count(1) from tb1
    group by [email]
    having count(1)>1
      

  2.   

    select * from(
    select email, count(*) as 重复条数 from talbe group by email
    ) a where 重复条数>1
      

  3.   

    比如
    id   email
    2    [email protected]
    3    [email protected]
    5    [email protected]
    8    [email protected]要结果
    2    [email protected]
    8    [email protected]
      

  4.   

    select [email] from tb1 group by [email] having count(1)>1
      

  5.   

    select * from tb where exists(select 1 from tb where emali=t.email and id<.t.id)
      

  6.   

    select * from table1 as a where exists(select 1 from table1 where email=a.email having count(1)>1) 
      

  7.   

    select * from tb where exists(select 1 from tb where emali=t.email and id<>t.id)