'2019/10/04'에 해당되는 글 1건

  1. 2019.10.04 postgresql rank() over()

중복되는 놈들이 있을때 값이 가장 큰 한놈만 빼서 쓰기 위해 사용한 함수.

그 외에는 어떤 목적으로 써야 하려나?

 

select (

SELECT depname, empno, salary, rank() OVER (PARTITION BY depname ORDER BY salary DESC) FROM empsalary;

) where rank = 1;

[링크 : http://www.postgresqltutorial.com/postgresql-rank-function/]

[링크 : https://www.postgresql.org/docs/9.1/tutorial-window.html]

Posted by 구차니