Home > Database > Mysql Tutorial > 读取MYSQL数据库中某个表的第一行和最后一行数据_MySQL

读取MYSQL数据库中某个表的第一行和最后一行数据_MySQL

WBOY
Release: 2016-06-01 13:06:40
Original
4264 people have browsed it

读取第一行

         select * frommytable order byIDasc limit 0,1

读取最后一行

           select * from mytable order by ID desclimit 0,1

读取前100行

          select * from mytable order byIDasc limit 0,100

mytable即是要读取的表名,ID是要排序的对象。
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