加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

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

发布时间:2020-12-12 07:36:36 所属栏目:MsSql教程 来源:网络整理
导读:在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条 复制代码 代
在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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读