Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Totals for very few columns
In SqlPlus you could use
select cust_id,Location,sum(Circuits)
from table
group by cust_id,location;
In PlSql you'll need to set up a loop to aggregate the values before moving to a new cust_id ; check the docs on loops in PlSql
milesr_at_my-deja.com wrote:
>Hello, My name is Ronald.
>
> I'm currently running Oracle 8.5
>
> This is an abbreviated report format of my current database:
>
> Cust_id Location Circuits
> 159 FT. Bragg 42
> 159 FT. Bragg 5
> 159 FT. Bragg 1
>
> Now, if they have the same custid I'd like to add the circuits
>together so I'd only see one record per custid and the circuits number
>would represent the total number of circuits for that custid.
>
> For example:
>
> Cust_id Location Circuits
> 159 FT. Bragg 48
>
> Could someone tell me how to accomplish this task in PL/SQL. It would
>be appreciated.
>
>Thanks,
>Ronald
>
>
>
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==---------- http://www.newsfeeds.com The Largest Usenet Servers in the World! ------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==----- Received on Tue Dec 14 1999 - 15:16:48 CST