如果表非常大,需要用rownum查詢指定的幾條,下面命令可以實現(xiàn)
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')