Top N reporting based on customer revenues



Query

select qry.party_name, qry.revenue, dense_rank() over (order by qry.revenue desc) as rank
from
(select (select party_name from hz_parties p, hz_cust_accounts ca where ca.party_id = p.party_id and cust_account_id = ps.customer_id) party_name
, sum(amount_due_original) revenue
from ar_payment_schedules_all ps
where class = 'INV'
group by ps.customer_id) qry

Comments

Popular posts from this blog

Query to get FSG report details with row/column set

How to use lexical parameters in Data template (XML document) R12

Sub Inventory Transfer API.