在 user 表中, 有email 这个字段,我现在想查询所有email 不含重复的数据

解决方案 »

  1.   

    select distinct email  from user ?
      

  2.   

    select email ,count(1) from user  group by email  having count(1)=1
      

  3.   

    楼上的大哥厉害,有个小问题哦, 如果我要是想在select 后查询出 所有的数据 该怎么写
    谢谢了
      

  4.   

    select * from user where email in 
    (select email  from user group by email having count(*)=1)
      

  5.   

    select email ,count(1) from user group by email having count(1)=1
      

  6.   


    select * from user where id in (
    select id from (
    select max(id), email ,count(1) from user group by email having count(1)=1 
    )
    )
      

  7.   

    select email from users where email in 
    (select email from users having count(*)<2 group by email)
      

  8.   

    通过rowid来精确和高效处理重复数据问题吧SELECT *
    FROM USERS
    WHERE ROWID IN (SELECT MAX(ROWID) FROM USERS t GROUP BY t.email)
    ORDER BY 1