咨询一个少见的mysql查询语句 在mysql表中,有10000行数据,根据时间字段可以分成20个组,如何通过一句取得每个20组中的第一行以及最后一行数据?数据按照id的自增长排序,id为主键 谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 参考下贴中的多种方法http://topic.csdn.net/u/20091231/16/2f268740-391e-40f2-a15e-f243b2c925ab.html[征集]分组取最大N条记录方法征集,及散分.... select *from tb Awhere not exists (select 1 from tb where A.时间字段=时间字段 and A.id>id)union allselect *from tb Awhere not exists (select 1 from tb where A.时间字段=时间字段 and A.id<id) 贴建表及插入记录的SQL,及要求结果出来看看 Update语句 sql查询,进来解下惑 Linux上MySQL5.1编译提示内存不足 问个建表的问题啊~~~~~~~不知道怎么查baidu mysql 自增长字段的设定 php操作MYSQL LOCK TABLES的问题 一个回滚的问题 mysql中在查询结果中行列互换? 在5.0.1中建视图如何使用UNION mysql更新数据库, 错误 42000 mysql select into 导出文件的编码格式 txt文件导入到数据库问题
[征集]分组取最大N条记录方法征集,及散分....
from tb A
where not exists (select 1 from tb where A.时间字段=时间字段 and A.id>id)
union all
select *
from tb A
where not exists (select 1 from tb where A.时间字段=时间字段 and A.id<id)