Closed nadizeq closed 3 years ago
If return of the sql needs to be customize as per example above. Then it needs a customized bean or solution as below
https://stackoverflow.com/questions/33701905/springdatajpa-custom-data-mapping-with-native-query
The function of PARTITION BY clause is to divide the result set into partitions and perform computation on each subset of partitioned data.
The syntax of PARTITION BY clause: window_function ( expression ) OVER ( PARTITION BY expression1, expression2, ... order_clause frame_clause )
An example of it which returns the employee's salary and the average salary of the employee department: SELECT first_name, last_name, department_id, ROUND(AVG(salary) OVER ( PARTITION BY department_id )) avg_department_salary FROM employees;
Resource: