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

Home -> Community -> Usenet -> c.d.o.server -> Re: Need help with sum

Re: Need help with sum

From: Spencer <spencerp_at_swbell.net>
Date: Mon, 28 May 2001 13:43:11 -0500
Message-ID: <wZwQ6.40$4_5.87947@nnrp2.sbc.net>

"sum" is a aggregate function, not a command. if you're table is consists of two columns, "name" and "price", with price defined as a numeric:

try this:

select name, sum(price)
from My_table
group by name

if your table is defined as a single VARCHAR2 column "name......price", then you're going to need to perform some single-row functions to break out the components into two separate expressions.

"claudio" <cat_bwo_at_hotmail.com> wrote in message news:98a9ad28.0105250544.41be8235_at_posting.google.com...
> My table looks like this:
>
> name...................price
> Schwarzenegger...........100
> Fonda.....................10
> Fonda.....................40
> Fonda....................200
> Thomas....................50
> Thomas....................20
>
>
> Sql should give this:
>
> name...................price
> Schwarzenegger...........100
> Fonda....................250
> Thomas....................70
>
>
> The sum command does not seem to work in this case (only whole
> columns?), any help would be greatly appreciated :-).
>
Received on Mon May 28 2001 - 13:43:11 CDT

Original text of this message

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