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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Is it possbile to SUM the members of a group expression in SQL?

Re: Is it possbile to SUM the members of a group expression in SQL?

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 11 Nov 2001 08:01:50 -0800
Message-ID: <9sm7de02k59@drn.newsguy.com>


In article <B81475EF.A2FB%chris_newman_at_bigpond.com>, Chris says...
>
>SUM only works on the entire column.
>
>But is it possible to produce a subtotal so that table with contents this
>
>Name date1 price
>Name date1 price
>Name date1 price
>Name date1 price
>Name date2 price
>Name date2 price
>Name date2 price
>Name date2 price
>
>
>Displays as
>
>Name Date1 (total prices related to date1)
>Name Date2 (total prices related to date2)
>

don't you simply mean:

select name_column, date_column, sum(price)   from t
group by name_column, date_columns;
/

I don't know what you mean by:
>SUM only works on the entire column.

doesn't really compute...

--
Thomas Kyte (tkyte@us.oracle.com)             http://asktom.oracle.com/ 
Expert one on one Oracle, programming techniques and solutions for Oracle.
http://www.amazon.com/exec/obidos/ASIN/1861004826/  
Opinions are mine and do not necessarily reflect those of Oracle Corp 
Received on Sun Nov 11 2001 - 10:01:50 CST

Original text of this message

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