SELECT * FROM
(SELECT * FROM  tb_item WHERE id<800000)d
WHERE d.id> 500000mysql数据库,在tb_item中查id在50000到80000之间的记录,有什么语法问题吗?在SQLyog上执行,通不过啊?

解决方案 »

  1.   


    mysql> create table test(id int);
    Query OK, 0 rows affected (0.06 sec)mysql> select * from (select * from test where id>500) d where d.id <=100;
    Empty set (0.05 sec)mysql>
      

  2.   

    看着没问题吧。不行换种写法。用between and或者两个and 连接
      

  3.   

    select  *   from  tb_item where id between 50000 and 80000
      

  4.   

    在sql server上没错,我试了相似的写法,能通过:疑问:SQLyog是什么东东?(新人不知啊,莫怪)
      

  5.   

    4楼的,不可以吗?
    select  *   from  tb_item where id between 50000 and 80000 
      

  6.   

    为什么不用 and
    和between 
      

  7.   

    我也想说为什么不用and或者between呢。
      

  8.   

    用between