如何获取本应返回的行数?
在以下查询中:
SELECT column1,column2 FROM table1 ORDER BY column1 LIMIT 0,30
如何找出如果没有 LIMIT
将返回的行数?
编辑:我正在寻找一种方法将其处理到上面的查询中,而不是进行单独的查询。 (如果可能的话。)
In the following query:
SELECT column1,column2 FROM table1 ORDER BY column1 LIMIT 0,30
How can I find out the number of rows that would have been returned were it not for the LIMIT
?
Edit: I am looking for a way to work this into the query above and not do a separate query. (If possible.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您执行此查询:
您可以检索上一个 SELECT 找到的行数
如果您确实必须使用一个查询来执行此操作,则必须使用子选择(这将具有添加额外列的缺点每行..)
If you do this query:
You can retrieve the number of rows the previous SELECT found with
If you really must do it with one query, you'll have to use a sub select (which'll have the disatvantage of adding an extra column to every row..)