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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Question about query with SUM

Re: Question about query with SUM

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Wed, 27 Dec 2000 06:49:05 +0100
Message-ID: <92c9m1$6fev5$1@ID-62141.news.dfncis.de>

select id, sum(usage)
from usage
group by id
/

which will make id distinct also

Hth,

Sybrand Bakker, Oracle DBA

"Rolf Kamp" <rfk_at_exit109.com> wrote in message news:3A4936C1.35597C57_at_exit109.com...
> Hi:
> I have a table with 2 rows:
> - ID (a varchar)
> - usage (a number)
>
> Presently, I have a query that returns the distinct IDs in the
> table, then I query the table and SUM(usage) for each unique ID. I would
> like to have oracle do both steps for me in 1 query. So far I have this:
>
> select distinct ID, SUM(USAGE)
> from USAGE;
>
> But I get an error stating "Not a single group function".
>
> Any help is greatly appreciated.
> - rfk
>
Received on Tue Dec 26 2000 - 23:49:05 CST

Original text of this message

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