mysql 中的s表中有一字段名为floor (楼层的意思) 值 如 5/6 意为第五层 总层数为6
现想查 第5层 的所有记录
怎么实现呀,多谢

解决方案 »

  1.   

    select * from 表 where floor like '5/%'
      

  2.   

    select * from 表 where floor like '%5/%'
      

  3.   

    select * from s表 where `floor` like '5/%'
      

  4.   

    按楼主的意思,如果共6屋,查第五层直接 where fllor='5/6',否则where fllor like '%5/%'查所有楼的第五层!
      

  5.   

    select * from s表 where `floor` like '5/%'非 
    select * from s表 where `floor` like '%5/%'
    后者有可能搜到15楼,25楼
      

  6.   

    select * from `s表` wherefloor regexp "^5/[0-9]$";
      

  7.   

    select * from `s表` where floor regexp "^5/[0-9]+$";
      

  8.   

    多谢
    select * from 表 where floor like '5/%'