用最新时间排序,然后最新的前5条记录不要查询,查询第6条之后的记录用一条sql怎么实现?
解决方案 »
- mysql switch case语句探讨
- 如何实现在mysql主从复制时,主机坏掉主动切换到从机
- MySQL存储过程中如何保存select count(*)的结果为整数
- mysql update 语句:Lock wait timeout exceeded; try restarting transaction
- mysql存储大量图片性能如何?
- MYSQL的lock tables权限
- 从PostgreSQL数据库中的数据库中直接生成E-R图
- 如何在mysql的select语句中自动计数,急~~~
- 请教关于Linux下MySQL数据库的连接、读取、写入的速度问题!
- Notice:数据库链接错误 in
- 大家好,我修改MYSQL管理员密码的语法没有错,却始终不成功,为什么?
- mysql 每个连接的 最长时间是多少?
DELIMITER $$DROP PROCEDURE IF EXISTS `db`.`sp` $$
CREATE PROCEDURE `sp`()
begin prepare stmt from 'Select * from table limit 6,?' ; select count(*) into @inta from table; execute stmt using @inta; end $$DELIMITER ;
select count(*) from 你的表 into @cnt;
select * from 你的表 where 1 = 1 order by 时间字段 desc limit 6,@cnt;