现有一个表,字段有两个: id和password
现求一个select 语句,查询列出这个表中所有 password 字段相同的记录

解决方案 »

  1.   

    select *  from tablename where group by password;
      

  2.   

    select a.* from tbl a, tbl b where a.password=b.password
      

  3.   

    错了,应该是:
    select * from tablename group by password;
      

  4.   

    select * from table a 
    where (select count(*) from table where password=a.password)>1
      

  5.   

    刚才写的不对,会引起交叉结果,试试下面的:
    select a.* from tbl a, (select password, count(password) as sc from tbl) b where a.password=b.password and b.sc>1
      

  6.   

    select * form tablename where passwoord in (select password form tablename group by password having count(1)>1);
      

  7.   

    select a.* from gbook a, (select uname from gbook group by uname having count(uname) > 1) b 
    where a.uname = b.uname
    这个也对,引用打字员的,呵呵
      

  8.   

    select * from tablename group by password
    语句给你写了,但我估计执行不了,因为password和大多数数据库的关键字冲突
    建议换个字段名称