Count from a table, but stop counting at a certain number

前端 未结 3 1759
别跟我提以往
别跟我提以往 2021-01-18 08:13

Is there a way in MySQL to COUNT(*) from a table where if the number is greater than x, it will stop counting there? Basically, I only want to know

3条回答
  •  Happy的楠姐
    2021-01-18 09:05

    SELECT * FROM WhateverTable WHERE WhateverCriteria
    LIMIT 100, 1
    

    LIMIT 100, 1 returns 101th record, if there is one, or no record otherwise. You might be able to use the above query as a sub-query in EXIST clauses, if that helps.

提交回复
热议问题