美文网首页
oracle 倒序查最后几条数据或去重后时间段获取

oracle 倒序查最后几条数据或去重后时间段获取

作者: IT和金融 | 来源:发表于2017-08-23 17:00 被阅读0次

如果表非常大,需要用rownum查询指定的几条,下面命令可以实现

select * from(

select *

from T_NB_COPY t

order by create_time desc

) b where rownum <= 5

去重及时间段获取

select distinct t.device_id from T_RECEIVE_LOG t where  t.receive_time <= to_date('2018-02-28 00:00:00','yyyy-mm-dd hh24:mi:ss') and t.receive_time >= to_date('2018-02-27 00:00:00','yyyy-mm-dd hh24:mi:ss')

相关文章

网友评论

      本文标题:oracle 倒序查最后几条数据或去重后时间段获取

      本文链接:https://www.haomeiwen.com/subject/fpqjdxtx.html