Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Is it possbile to SUM the members of a group expression in SQL?
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 CorpReceived on Sun Nov 11 2001 - 10:01:50 CST