asked on
select CATEGORYID,cat , gross, net, discount,
(to_char(nvl(100 * (gross/sum(gross) over()),0),'fm9990.00')||'%' ) Cat_Perc,
(to_char(nvl(100 * (Discount/gross),0),'fm9990.00')||'%') Disc_Perc,
sum(gross) over() total_price from (
select CATEGORYID, cat ,
sum(PRICE) Gross,sum(DISCPRIC) Net,(sum(discount)) Discount , sum(quantity) QTY
from
sales_det
where
TO_char(dob, 'dd-mm-yyyy') >= '01-04-2015'
and TO_char(dob, 'dd-mm-yyyy') <= '30-04-2015'
group by CATEGORYID, cat )
order by gross desc ;
ASKER
If you want a SUM on every row for various categoriesexactly
just do the SUM with CASE and OVER from the previous question.you mean it will be added column ? ok , is it possible to do it as rows under various catigories ?
ASKER
ASKER
ASKER
Oracle is an object-relational database management system. It supports a large number of languages and application development frameworks. Its primary languages are SQL, PL/SQL and Java, but it also includes support for C and C++. Oracle also has its own enterprise modules and application server software.
TRUSTED BY