mysql查询例如这是表table1
date表示时间 字段 c ,d下面都是数值
date c d
09:35:00 245 524
09:36:00 234 42409:37:00 423 677
09:38:00 323 2342.......10:35:00 313 323
10:36:00 323 452
10:37:00 432 34210:38:00 532 344
希望给出详细的语句,谢谢
检测表中是否存在连续不间断5次d-c的差是否大于0
date表示时间 字段 c ,d下面都是数值
date c d
09:35:00 245 524
09:36:00 234 42409:37:00 423 677
09:38:00 323 2342.......10:35:00 313 323
10:36:00 323 452
10:37:00 432 34210:38:00 532 344
希望给出详细的语句,谢谢
检测表中是否存在连续不间断5次d-c的差是否大于0
解决方案 »
- php+mysql 正在后台处理时刷新网页,会中断处理吗?
- 去mysql匹配查询
- mysql 存储过程 发邮件
- 多表联合汇总求解
- mysql数据备份出来汉字是乱码
- 特郁闷的SQL,有谁知道
- mysqldump --add-drop-table -h127.0.0.1 -uroot -p --all-databases > db.sql 那里错了?
- [菜鸟问题]如何在触发器中添加2行或以上SQL语句?
- 请教高手:(1064) You have an error in your SQL syntax
- mysql数据库备份 不用mysqldump
- 判断有顺序的一组数中,是否有连续n个数均为正?急急急
- 求高手指教mySql复杂查询语句
建议你列出你的表结构,并提供测试数据以及基于这些测试数据的所对应正确结果。
参考一下这个贴子的提问方式http://topic.csdn.net/u/20091130/20/8343ee6a-417c-4c2d-9415-fa46604a00cf.html
1. 你的 create table xxx .. 语句
2. 你的 insert into xxx ... 语句
3. 结果是什么样,(并给以简单的算法描述)
4. 你用的数据库名称和版本(经常有人在MS SQL server版问 MySQL)
这样想帮你的人可以直接搭建和你相同的环境,并在给出方案前进行测试,避免文字描述理解上的误差。
(select tbl0.timeColumn from
(select timeColumn from GSYX where left(timeColumn,13) between '2000-01-01 13' and '2000-01-01 14' and (b-a)<=0.05
UNION ALL select '9999-12-31 23:59:59' as timeColumn) as tbl0
inner join
(select timeColumn from GSYX where left(timeColumn,13) between '2000-01-01 13' and '2000-01-01 14' and (b-a)>0.05) as tbl1
where tbl1.timeColumn > IFNULL((select max(timeColumn) from
(select timeColumn from GSYX where left(timeColumn,13) between '2000-01-01 13' and '2000-01-01 14' and (b-a)<=0.05) as maxtbl0
where maxtbl0.timeColumn <tbl0.timeColumn),'0000-00-00 00:00:00')
and tbl1.timeColumn<tbl0.timeColumn
group by tbl0.timeColumn
having count(*)>=5 limit 1) as derivedtbl)
,'GSYX',null) AS tableName;