1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | -- 조회 항목이 몇개 안될 때 : KEEP(DENSE_RANK -- SELECT id , MAX ( date ) date , MAX (seq) KEEP(DENSE_RANK LAST ORDER BY date ) seq FROM 테이블 GROUP BY id ; -- 조회 항목이 많을 때 : ROW_NUMBER -- SELECT * FROM ( SELECT id, date , seq , ROW_NUMBER() OVER(PARTITION BY id ORDER BY date DESC ) rn FROM 테이블 ) WHERE rn = 1 ; |