V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
sunhk25
V2EX  ›  程序员

mysql: select count until?

  •  
  •   sunhk25 · 2014-04-07 16:26:01 +08:00 · 2406 次点击
    这是一个创建于 3643 天前的主题,其中的信息可能已经有所发展或是发生改变。
    我想查询一个id按顺序wait_order排序后,count前面有多少个。
    mysql 有until这样的语句吗?
    select count(*) from reserves order wait_order until id = 3;

    `reserves` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `member_id` int(11) NOT NULL DEFAULT '0',
    `wait_order` smallint(4) NOT NULL DEFAULT '0'
    }
    id, member_id, wait_order
    1, 3, 1
    2, 3, 3
    3, 1, 2
    4, 2, 4
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2792 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 00:25 · PVG 08:25 · LAX 17:25 · JFK 20:25
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.