Practical implementation of Oracle Summary reports

Source: Internet
Author: User

Oracle has a very practical way of implementing summary reports. In the financial system or other report statistics function, I want to have a lot of cases similar to the following report. With the grouping_id function, it will be easy to implement, item No. of force of high charge increase/decrease of average daily balance cost rate of the previous year average daily balance cost rate total cost rate of average daily balance 1 Bank Loan 1 for commercial ticket quota China Development Bank 2 other credit line China Development Bank bank of America Group 2 split into three headquarters split into analysis: this table is a three-level summary. The bank summarizes the quota (Commercial quota, other quota), various quotas are summarized to the split-in method (bank loan, group split-in, Headquarters split-in), and the split-in method is summarized to the total. Grouping_id can achieve N-Level Progressive aggregation usage: Case select grouping_id (loan. nborrowtype, loan. nfinancetype, loan. ncounterpartyid) groupid, sum (loan. mbalance)/365 currentYearAvg, from billbalance loan where 1 = 1 group by rollup (loan. nborrowtype, loan. nfinancetype, loan. ncounterpartyid) order by loan. nborrowtype desc, loan. nfinancetype desc, loan. ncounterpartyid desc resolution: grouping_id (filed1, field2, field3 ....), differentiate fields. The function will Fields, that is, the split type in the table above. And so on, the second field is the second-level display, that is, the split mode ...., Group by rollup (filed1, field2, field3 ....) group field, same as order by loan. nborrowtype desc, loan. nfinancetype desc, loan. ncounterpartyid desc. Here, desc indicates that the summary row is displayed on the display row. If you want to display the summary row below, change it to asc .. Ps: The above three parts are indispensable

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.