MySql中取前几行数据使用limit来完成
更新时间:2013年07月29日 18:04:25 作者:
在mysql中是没有top关键字的,不过可以用limit来完成此功能,下面举例为大家详细介绍下它的使用方法,不会的朋友可以学习下
在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
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
相关文章
mysql installer community 8.0.12.0安装图文教程
这篇文章主要为大家详细介绍了mysql installer community 8.0.12.0安装图文教程,具有一定的参考价值,感兴趣的小伙伴们可以参考一下2018-08-08


最新评论