Oracle in-Over ()

Source: Internet
Author: User

Select To_date (: fr_date, ' Yyyy-mm-dd ') f_date,to_date (: to_date, ' Yyyy-mm-dd ') T_date,nnd,count (distinct memb_id) memb _count,count (bill_id) bill_count,sum (Bill_money) Pay_count,to_char (Round (sum (bill_money) *100/sum (SUM (Bill_money) )Over (),2), ' 990.99 ') | | ' % ' percent from (
Select Case when C.year_old>=1 and c.year_old<=10 then ' 1-10 '
When c.year_old>=11 and c.year_old<=20 then ' 11-20 '
When c.year_old>=21 and c.year_old<=30 then ' 21-30 '
When c.year_old>=31 and c.year_old<=40 then ' 31-40 '
When c.year_old>=41 and c.year_old<=50 then ' 41-50 '
Else ' over 50 years old ' end as Nnd,d.bill_id,d.memb_id,d.bill_date,d.bill_money,year_old
From
(Select Memb_id,floor (Months_between (sysdate,birth_date)/12) as Year_old from tb_ax001 a) C,
(select Bill_id,memb_id,bill_date,bill_money from tb_ax006 b where b.bill_date between to_date (: Fr_date, ' yyyy-mm-dd ') and To_date (: to_date, ' yyyy-mm-dd ') +0.99999) d
where c.memb_id (+) = d.memb_id) E
GROUP BY Nnd
ORDER BY Nnd

--sum (SUM (Bill_money)) over () total amount

Oracle in-Over ()

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.