Team,
We are using rank over() DB2 funtion in defintion of one the view of my application. We need to apply certain filters like time period etc before rank over() function is evaluated.
However, as rank over() is within view, view definition materialises first and then apply time filter on top of it, resulting in incorrect results.
Would you have any alternative or suggestion to implement my requirement.
View Defintion is :
create view vdw02.v_clist as
(select
a.ord_no
, a.base_id || a.basic_no as c
, rank()over (partition by a.base_id, a.basic_no order by a.ORD_NO,a.BASE_ID,a.BASIC_NO,a.MKT_CHAN_CD asc) as rnk
, rank()over (partition by a.base_id, a.basic_no order by (rank()over (partition by a.base_id, a.basic_no order by a.ORD_NO,a.BASE_ID,a.BASIC_NO,a.MKT_CHAN_CD asc)) desc) as rnk2
from dw02.clist a)