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: totals from every other few rows

Re: totals from every other few rows

From: PaulCinVT <paulcinvt_at_aol.com>
Date: 06 Jan 2000 16:28:13 GMT
Message-ID: <20000106112813.24255.00000123@nso-cg.aol.com>


In article <838v7i$jib$1_at_nnrp1.deja.com>, milesr_at_my-deja.com writes:

> This is a repost of my original message. I believe the first one
>was too vague. I'm currently running Oracle 8.5
>
> This is an abbreviated report format of my current database:
>
> Cust_id Location Circuits Phone_ext Study_Hour
> 159 FT. Bragg 42 3145 03
> 159 FT. Bragg 5 3145 03
> 159 FT. Bragg 1 3145 03
> 160 FT. Myer 8 9934 10
> 160 FT. Myer 12 9934 10
> 161 FT. Meade 11 1253 12
> 161 FT. Meade 13 1253 12
> 161 FT. Meade 16 1253 12
>
> Now, if they have the same Cust_id, I'd like to add the Circuits
>column together so I'd only see one record per Cust_id and the Circuits
>column would represent the total number of circuits for that Cust_id.
>
> My desired output would read for example:
>
> Cust_id Location Circuits Phone_ext Study_hour
> 159 FT. Bragg 48 3145 03
> 160 FT. Myer 20 9934 10
> 161 FT. Meade 40 1253 12
>
> Could someone tell me how to accomplish this task in PL/SQL. It would
>be highly appreciated.
>
> Thanks,
> Ronald
>

Select Cust_id, Location, SUM(Circuits), Phone_ext, Study_Hour from x group by cust_id, Location, Phone_ext, Study_Hour;

Paul in VT Received on Thu Jan 06 2000 - 10:28:13 CST

Original text of this message

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