Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: groupping and percentages

Re: groupping and percentages

From: Sergey V Dolgov <dsv_at_pptus.oilnet.ru>
Date: Mon, 06 May 2002 22:08:19 -0800
Message-ID: <F001.004599A1.20020506220819@fatcity.com>


Hello Gurelei,

Use subqueries:

select a.group "Group", a.number "Number", a.number/b.cnt*100 "Percent" from (select group, count(group) number

        from test_table
       group by group) a,
     (select count(*) cnt from test_table) b;

Wednesday, May 01, 2002, 1:57:39 AM, you wrote:

G> Hi all:

G> There have been a few threads here dealing with G> calculating percentages e.g:

G> Group Number Percent
G>   1     10     10%
G>   2     10     10%
G>   4     70      70%
G>   9     10     10%

G> I'm also sure I saw articles on how to create a report
G> like this via Oracle, but I couldn't find one when I
G> need it. If someone has a query or a link to such an G> artice, could you please froward it to me.

G> thanks

G> Gene

G> __________________________________________________
G> Do You Yahoo!?

G> Yahoo! Health - your guide to health and wellness G> http://health.yahoo.com

--

Best regards,

 Sergey                            mailto:dsv_at_pptus.oilnet.ru


--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Sergey V Dolgov
  INET: dsv_at_pptus.oilnet.ru

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Tue May 07 2002 - 01:08:19 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US