SELECT * FROM 
(select A.ENNMCD,C.ennm 测站,A.RTLV ,A.LV8 时,A.RTLV 当前,A.INMSGTM,RANK() OVER ( partition by A.ENNMCD order by A.INMSGTM desc ) AS RK from U_ST_RLWT A,U_gn_ennmcd C where A.Ennmcd=c.ennmcd and to_char(A.INMSGTM ,'yyyy-mm-ddhh') = '2004-07-1917') WHERE RK=1这句本身倒不是复杂,只是因为在子查询中用了RANK() OVER ( partition by A.ENNMCD order by A.INMSGTM desc 导致速度变慢一些,A.Ennmcd和c.ennmcd 可以考虑建索引,而且条件中两个条件一样的,就直接写成等于好了.