Hi Frank,
I am giving below link as reference as this new requirement/addtional which i am asking in this thread is, the logic of bundling orders remain same, for bundling orders we used row_number() and anaytical function SUM() over partition by and son...
Below is the sanpshot of your solution where we were doing partition based on custno and category and were fining sum and bundling the orders.
Now, I need to to sum(donation) based on two conditions
1. if cateogry is DEBIT then do partition by custno, category
2. if cateogry CREDIT then partition by category only.
Please use below sample data
undefined (0 Bytes)
Below is same sample data-
With A as
(select '10060' custno, '364162' slipno, 'DEBIT' category,8520 donation from dual union all
select '10060' custno, '364161' slipno, 'DEBIT' category,17680 donation from dual union all
select '10060' custno, '673346' slipno, 'DEBIT' category,23440 donation from dual union all
select '117112' custno, '558190' slipno, 'DEBIT' category,16720 donation from dual union all
select '110291' custno, '681430' slipno, 'DEBIT' category,13597 donation from dual union all
select '110291' custno, '681432' slipno, 'DEBIT' category,9278 donation from dual union all
select '110291' custno, '631094' slipno, 'CREDIT' category,4970 donation from dual union all
select '110291' custno, '627106' slipno, 'CREDIT' category,3378 donation from dual union all
select '117112' custno, '624657' slipno, 'CREDIT' category,17133 donation from dual union all
select '113042' custno, '530736' slipno, 'DEBIT' category,594 donation from dual union all
select '113042' custno, '526144' slipno, 'DEBIT' category,17676 donation from dual union all
select '127182' custno, '433715' slipno, 'DEBIT' category,17712 donation from dual union all
select '127182' custno, '433716' slipno, 'DEBIT' category,5913 donation from dual ;
)
This is sample data
Thanks,
M