找回密码
 立即注册
搜索
热搜: 生活 中国

Mysql查询数据库表中前几条记录

[复制链接]
admin 发表于 2015-10-25 18:59:38 | 显示全部楼层 |阅读模式
Mysql查询数据库表中前几条记录
两层嵌套的方法
select * from student where id not in (select t . id from (select * from student limit 7 ) as t );
Mysql查询数据库表中前几条记录的方法记含义:
select * from student limit 5 ; // 取出前五条记录
select * from student limit 0 ,5; //取出前五条记录 select * from student limit 3,10;//取出3后面的10条记录,不包括3select*from student order by rand() limit 2; // 从表中随机取出2 条记录,这里2 可以自己改

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|生活导航|生活导航 ( 新ICP备12003026-1号 )

GMT+8, 2024-5-20 18:36 , Processed in 0.075840 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表