本帖最后由 dajiahaoma444 于 2011-01-27 20:13:03 编辑

解决方案 »

  1.   

    select * from table1 a
    where exists (select 1 from table1 where userpass=a.userpass and id!=a.id)
      

  2.   

    我的表名字叫 table1 ID的字段名也叫id
    但是为什么总提示我语法错误ERROR 1064 (42000)....什么什么的
      

  3.   

    呵。。见笑了。
    我以为这个错误大家应该闭着眼睛就知道了
    mysql> select * table1 a where exists(select 1 from table1 where userpass=a.userpass and id!=a.id;
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
    corresponds to your MySQL server version for the right syntax to use near '' at
    line 1
      

  4.   

    锻炼一下找不同。 我也本以为楼主一定会复制粘贴。select * table1 a where exists(select 1 from table1 where userpass=a.userpass and id!=a.id;
      

  5.   

    呵,谢谢了。刚翻了下书。
    用别名搞定了
    谢谢
    select * from table1 as t,table1 where table1.userpass=t.userpass and table1.id!=t.id;