1. 程式人生 > >oracle 分組取第一行資料 ,查詢sql語句

oracle 分組取第一行資料 ,查詢sql語句

oracle  分組取第一行資料

SELECT * FROM (

SELECT ROW_NUMBER() OVER(PARTITION BY x ORDER BY y DESC) rn,
t.*
FROM test1 t
) WHERE rn = 1;

 

查詢oracle  執行的語句 

select t.*
from v$sqlarea t
where t.FIRST_LOAD_TIME like '2018-11-05%'
order by t.FIRST_LOAD_TIME desc