一个表中,我需要从id字段查询出id=1,3,5,7,9所有单数的记录,应该怎么写

解决方案 »

  1.   

    select * from tbl where id in(1,3,5,7,9)
      

  2.   

    select * from tb where id % 2 = 1
      

  3.   

    select * from TB where id in (1,3,5,7,9)
      

  4.   

    select * from T where id mod 2 = 0
      

  5.   

    select * from T where id mod 2 = 1
      

  6.   

    如果你是仅仅查询1,3,5,7,9.
    select * from tb where id in (1,3,5,7,9)如果你是查询奇数.
    select * from tb where id % 2 = 1
      

  7.   

    所有单数
    select * from tbl where id/2<>0