select * from ( select a.*,rank() over (partition by a.LBrCode,a.PrdAcctId order by a.DpDate ) rnk_firt, rank() over (partition by a.LBrCode,a.PrdAcctId order by a.DpDate desc ) rnk_last from D009046 a where a.DpDate<='31-mar-2021' ) x where rnk_firt=1 or rnk_last=1 and PrdAcctId='CC 000000000000006800000000' and LBrCode=1
how do I achieve this ?
19 People are following this question.