*****************sql语句求简化,求速度****************
本帖最后由 reyreoitoo 于 2013-12-16 11:37:42 编辑 select loopid,timestamp from onlinetrafficdata
where max(to_char(timestamp,'yyyy-mm-dd hh24:mi') in (select max(to_char(timestamp,'yyyy-mm-dd hh24:mi'))From onlinetrafficdata);
[解决办法]
略改
select * from
(select loopid,timestamp,rank() over (order by to_char(timestamp,'yyyy-mm-dd hh24:mi') desc ) as rnk
from onlinetrafficdata )
where rnk=1