select * from spec where id>13 and id<18
这是查询第13条到第18条的记录
查询第13条到第18条的记录 和 查询第20条到第25条的记录   两个一起  应该怎么写?小弟菜鸟~~!这个不会!

解决方案 »

  1.   

    select * from spec where (id>13 and id<18) || (id>20 and id<25)
      

  2.   

    select * from spec where (id>13 and id<18) or (id>20 and id<25)
      

  3.   

    好像不行~~~~~~!
    我用PHP的
      

  4.   

    嗯 报错~~~!
    源码是这个
    <?php
    $conn = new com("ADODB.Connection"); 
    $connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("database/special.mdb");
    $conn->Open($connstr);
    $rs = new com("ADODB.RecordSet"); 
    $rs->Open("select * from spec where (id>0 and id<5) xor (id>12 and id<20))",$conn,1,1); 
    while(! $rs->eof) {
    ?>
      

  5.   

    rs->Open("select * from spec where (id>0 and id<5) xor (id>12 and id<20))",$conn,1,1);//应该是or
      

  6.   

    (id>0 and id<5) xor (id>12 and id<20))xor不对吧
      

  7.   

    rs->Open("select * from spec where (id>0 and id<5) xor (id>12 and id<20))",$conn,1,1);//多了个括号
      

  8.   

    (id>0 and id<5) or (id>12 and id<20))多了一个括号~~~!呵呵  解决了!感谢大家
      

  9.   

    (id>0 and id<5) xor (id>12 and id<20))xor也是可以的哦~~~!
    呵呵!