Run a query with a LIMIT/OFFSET and also get the total number of rows

后端 未结 4 2090
醉话见心
醉话见心 2020-12-12 11:31

For pagination purposes, I need a run a query with the LIMIT and OFFSET clauses. But I also need a count of the number of rows that would be return

4条回答
  •  感动是毒
    2020-12-12 12:07

    No.

    There's perhaps some small gain you could theoretically gain over running them individually with enough complicated machinery under the hood. But, if you want to know how many rows match a condition you'll have to count them rather than just a LIMITed subset.

提交回复
热议问题