Use SUM PARTITION BY in DB view
Dear Sir / Madam,
I want to create a DB view with SUM PARTITION BY column definition. However, when I join the DB view with a where-clause, the value of SUM PARTITION BY is not subject to change by the where-clause. For example:
create view test_view as
select employee_number, leave_start_date, sum(leave_duration) (partition by employee_number) as sum_of_duration from apps.leave_table;
then I create a SQL like this:
select * from test_view where leave_start_date >= sysdate - 7;
I expect the sum_of_duration would be changed if I provide different value for the where-clause (leave_start_date >= ?). However it doesn't. Do you have any idea and any alternative for this?