select * from table where id in ('select parentid from table where parentid !=0')
Mysql返回  Empty set (0.00 sec)

解决方案 »

  1.   

    select * from table where id in ('select parentid from table where parentid >0')
      

  2.   

    谢谢楼上兄弟的回复,执行的时候Mysql还是返回  Empty set (0.00 sec)
      

  3.   

    gzty(风逍遥) 你这个SQL语句在我的机器上不管用啊,是不是对版本有要求,在低版本的服务器上该怎么写,谢谢
      

  4.   

    select * from table where id in (select parentid from table where parentid >0) and parentid=0;
    这个不要加引号,后面加上parentid=0是为了只选择主题,在表里插入一个(6,4,888,888)就能看出区别来了如果版本低试试这个:
     select * from table as a, table as b where a.id=b.parentid and parentid=0;
      

  5.   

    下面一句写错了,应该是
    select * from table as a, table as b where a.id=b.parentid and a.parentid=0;
      

  6.   

    谢谢楼上的 helloyou0(你好!) 
    问题已经搞定~ 谢谢!