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

Home -> Community -> Usenet -> c.d.o.misc -> SQL recursive multiply

SQL recursive multiply

From: <james_at_france-mail.com>
Date: Fri, 29 Jan 1999 13:37:48 GMT
Message-ID: <78sdjb$e90$1@nnrp1.dejanews.com>


Hi,

 Let s assume, I have the following table :

PID ID QTE
--- -- ---
10 20 3
20 31 2
20 32 3
10 21 2
21 33 5
10 23 1

The first question is : how to multiply the QTE column, the same way I can do a simple sum(QTE), to get : 3*2*3*2*5*1=180

The second question is : if I consider the following three build with a "start with/connect by" function where PID=parent Identifier and ID=Identifier, how can I recursivly multiply the quantities (QTE) to get the quantity I need for each lowest level :

10
  20
    31 (3*2=6)
    32 (3*3=9)
  21
    33 (2*5=10)
  23 (1=1)

Regards, Remy James.

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Fri Jan 29 1999 - 07:37:48 CST

Original text of this message

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