MySQL限制范围 [英] MySQL limit range

查看:75
本文介绍了MySQL限制范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SELECT name FROM mydb ORDER BY score DESC LIMIT 10;

上面的查询将返回前10位.

The query above will return the first 10 ranks.

如何修改LIMIT,或者是否存在另一种语法来查询第10位到第20位?

How to modify the LIMIT, or maybe is there another syntax to query the 10th rank through the 20th rank?

推荐答案

这确实是基本的东西.您应该使用:

This is really basic stuff. You should use:

SELECT name FROM mydb ORDER BY score DESC LIMIT 10,10;

http://dev.mysql.com/doc/refman/5.5/en/select.html

两个参数10,10是(Offset,Limit),因此它将检索第11-20行.
9,11将被要求获得第10-20名.

The two arguments 10,10 are (Offset, Limit) so this will retrieve rows 11-20.
9,11 Would be required to grab the 10th - 20th rank.

这篇关于MySQL限制范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆