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 -> Multiplying columns from different rows

Multiplying columns from different rows

From: <milesr_at_my-deja.com>
Date: Wed, 05 Jan 2000 19:05:47 GMT
Message-ID: <8504lv$agt$1@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...

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.

 Thanks,
 Ronald

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Wed Jan 05 2000 - 13:05:47 CST

Original text of this message

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