Path: news.easynews.com!easynews!sjcppf01.usenetserver.com!usenetserver.com!cyclone.bc.net!logbridge.uoregon.edu!pln-e!spln!dex!extra.newsguy.com!newsp.newsguy.com!drn
From: Thomas Kyte <tkyte@us.oracle.com>
Newsgroups: comp.databases.oracle.misc
Subject: Re: Is it possbile to SUM the members of a group expression in SQL?
Date: 11 Nov 2001 08:01:50 -0800
Organization: Oracle
Lines: 41
Message-ID: <9sm7de02k59@drn.newsguy.com>
References: <B81475EF.A2FB%chris_newman@bigpond.com>
NNTP-Posting-Host: p-545.newsdawg.com
X-Newsreader: Direct Read News 2.90
Xref: easynews comp.databases.oracle.misc:72021
X-Received-Date: Sun, 11 Nov 2001 13:03:39 MST (news.easynews.com)

In article <B81475EF.A2FB%chris_newman@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 

