Hi! My below script working I got result.
Now I want get result like below example. I am using oracle 11g.
SQL
WITH cte_month AS
(SELECT row_number() OVER(PARTITION BY to_char(r.balance_date, 'Month'), to_char(r.balance_date, 'Year') ORDER BY balance_date DESC) row_num,
arrears_in_days,
balance_date
FROM history r
where r.acct_id in ('1100', '1101')
and (to_char(r.balance_date, 'D')) not in (6, 7))
SELECT arrears_in_days, balance_date
FROM cte_month
WHERE row_num = 1
order by balance_date;
Now I want get result like below example. I using oracle 11g.
0
|
7/30/2021
|
0
|
8/31/2021
|
0
|
9/30/2021
|
0
|
10/29/2021
|
0
|
11/30/2021
|
0
|
12/31/2021
|
8
|
1/31/2022
|
1100
|
0
|
7/30/2022
|
1
|
8/31/2022
|
2
|
9/30/2022
|
0
|
10/29/2022
|
0
|
11/30/2022
|
0
|
12/31/2022
|
9
|
1/31/2023
|
1101
|