Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Multiplying columns from different rows
<milesr_at_my-deja.com> wrote in message news:8504lv$agt$1_at_nnrp1.deja.com...
> Hello All,
>
> I'm trying to developed the code to write one cust_id per row, with
> the perc_overflow column mulitlpied by other perc_overflow columns with
> the same cust_id. I'm not sure whether I need a cursor, trigger, control
> structure, etc...
None.
> This is an abbreviated report format of the database:
>
> Cust_id Location perc_overflow 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 14 1253 12
> 161 FT. Meade 13 1253 12
> 161 FT. Meade 16 1253 12
>
> Now, if they have the same Cust_id, I need to multiply the
> perc_overflow columns so I'd only see one record per Cust_id and the
> perc_overflow column would represent the total percentage of over flowed
> circuits for that Cust_id.
>
> The desired output would read for example:
>
> Cust_id Location perc_overflow Phone_ext Study_hour
> 159 FT. Bragg 210 3145 03
> 160 FT. Myer 96 9934 10
> 161 FT. Meade 2912 1253 12
>
> Could someone please give me some guidance towards accomplishing this
> task in PL/SQL. I'm still not getting any output, probably because none
> of my queries make any sense.
select cust_id, location, exp(sum(ln(prec_overflow))), phone_ext, study_hour
from ....
group by cust_id, location, phone_ext, study_hour;
Received on Fri Jan 07 2000 - 09:28:33 CST
![]() |
![]() |