V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
sunhk25
V2EX  ›  程序员

mysql: select count until?

  •  
  •   sunhk25 · Apr 7, 2014 · 2789 views
    This topic created in 4413 days ago, the information mentioned may be changed or developed.
    我想查询一个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
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   972 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 19:13 · PVG 03:13 · LAX 12:13 · JFK 15:13
    ♥ Do have faith in what you're doing.