Home > Database > Mysql Tutorial > body text

MySql中取前几行数据使用limit来完成_MySQL

WBOY
Release: 2016-06-01 13:25:23
Original
1091 people have browsed it

bitsCN.com 在mysql中是没有top关键字的,在mysql中可以用limit来完成功能。

order by id desc limit 10 按照id的倒序排序 取出前10条
order by id desc limit 0,10 按照id的倒序排序 取出前10条
order by id limit 5,10 按照id的正序排序 从第5条开始取10条

SELECT cat_id FROM shop_goods_type order by cat_id desc limit 1
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