Home > Database > Mysql Tutorial > mysql中limit的用法深入分析_MySQL

mysql中limit的用法深入分析_MySQL

WBOY
Release: 2016-06-01 13:24:43
Original
930 people have browsed it

bitsCN.com

select * from table limit m,n其中m是指记录开始的index,从0开始,n是指从第m条开始,取n条。

mysql(root@localhost:test)>select * from total;
+----+-----------------+--------+------------+
| id | name            | number | mydate     |
+----+-----------------+--------+------------+
|  1 | 河南出版社      |   1000 | 2008-03-24 |
|  2 | 河南出版社      |   1200 | 2009-04-24 |
|  3 | 河南出版社      |   1100 | 2010-04-24 |
|  4 | 河南出版社      |   1400 | 2011-04-24 |
|  5 | 河南出版社      |   1350 | 2012-04-24 |
|  6 | 北京出版社      |   2000 | 2008-03-24 |
|  7 | 北京出版社      |   2020 | 2009-04-24 |
|  8 | 北京出版社      |   2050 | 2010-04-24 |
|  9 | 北京出版社      |   1980 | 2011-04-24 |
| 10 | 北京出版社      |   2100 | 2012-04-24 |
+----+-----------------+--------+------------+
10 rows in set (0.00 sec)

mysql(root@localhost:test)>select * from total limit 2,3;
+----+-----------------+--------+------------+
| id | name            | number | mydate     |
+----+-----------------+--------+------------+
|  3 | 河南出版社      |   1100 | 2010-04-24 |
|  4 | 河南出版社      |   1400 | 2011-04-24 |
|  5 | 河南出版社      |   1350 | 2012-04-24 |
+----+-----------------+--------+------------+
3 rows in set (0.00 sec)

大致就是这么个意思。

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template