数据库中的数据是30秒存一次,数据如下:
1 2010-06-01 00:00:00
2 2010-06-01 00:00:30
3 2010-06-01 00:01:00
...
...
...
n 2010-08-01 00:00:00如果我要查一个月的数据,都显示出来数据量太大,所以想把一个月的数据进行过滤,每10分钟抽取一条记录就行了,查询结果如下:
1 2010-06-01 00:00:00
2 2010-06-01 00:10:00
3 2010-06-01 00:20:00
...
...
...
n 2010-07-01 00:00:00请问各位大侠要得到上面的查询结果如何写SQL语句??????????????
1 2010-06-01 00:00:00
2 2010-06-01 00:00:30
3 2010-06-01 00:01:00
...
...
...
n 2010-08-01 00:00:00如果我要查一个月的数据,都显示出来数据量太大,所以想把一个月的数据进行过滤,每10分钟抽取一条记录就行了,查询结果如下:
1 2010-06-01 00:00:00
2 2010-06-01 00:10:00
3 2010-06-01 00:20:00
...
...
...
n 2010-07-01 00:00:00请问各位大侠要得到上面的查询结果如何写SQL语句??????????????
解决方案 »
- oracle查询连续记录,如何查
- sqlplus命令下输入!报错csh: Permission denied.
- 大家帮忙看看这条sql语句怎么优化 谢谢啦
- ora-06550 PLS-00103
- 比行列转换还难的交叉表怎么写?
- ORA:-12535 TimeOut时间在哪里设定?
- 如何在SQL中比较IP范围!!
- 我用PL/SQL Developer导出的表,为什么在别的库中导入不进去?
- 請高手指点:我是刚接触Oracle的新手。推荐几本Oracle的入门书籍和一些网站。
- 如何将ORACLE数据库的表记录输出到文本文件(成功后加分100)
- 这段oracle 连接 jsp connect的方法哪儿错了
- 数据库定时导入
select id,time1 from(
select id,time1,lag(time1) over(order by id) time2 from tab
) where (time1-time2)*24*60 = 10 and time2 is null无环境,未验证
select t.*,to_char(t.birth,'mi:ss'), t.rowid from tbtime t
where to_char(t.birth,'mi:ss') in ('00:00','10:00','20:00','30:00','40:00','50:00')
where to_char(t.birth,'mi:ss') in ('00:00','10:00','20:00','30:00','40:00','50:00') order by t.birth需要加order by不?
where substr(to_char(dt,'yyyy-mm-dd hh24:mi:ss'),15,5) in('00:00','10:00','20:00','30:00','40:00','50:00')
where mod(((time-to_date('20100806123123','yyyymmdd'))*24*60),10)=0
这个可以试下 借用下这位兄弟的
select id,time1 from(
select id,time1,lag(time1) over(order by id) time2 from tab
) where (time1-time2)*24*60 =7(or 14) and time2 is null
如果是按照下面这样写的话:
select * from tb
where substr(to_char(dt,'yyyy-mm-dd hh24:mi:ss'),15,5) in('00:00','10:00','20:00','30:00','40:00','50:00')
那么这个substr里面取的数据都是如下的数据,
1 44:40
2 39:12
3 40:03
4 04:46
5 18:57
6 54:38
7 59:50
8 50:43
9 30:26
10 00:45那取出的数据不就乱套了吗?小时不一致还有日期不一致的问题不都出来了?
所以我感觉不可取 这个方法!
select id,time1,lag(time1) over(order by id) time2 from tab
) where (time1-time2)*24*60 =7(or 14) and time2 is null
中,time1和time2的定义和“(time1-time2)*24*60 =7”看不懂!!!解释一下!!!