"Connect by-start with" help

From: Deepa Raman <DeepaR_at_aeimusic.com>
Date: Wed, 31 Mar 1999 12:14:09 -0800
Message-ID: <7dtutn$7sq$1_at_brokaw.wa.com>



Hi all,
I have a question as to how to perform a specific query.

I have a 2 tables.


            A                                    B
Col1    Amt.                Col1           Parent Col
-------   -------                ------            --------------
1           10                      1                   1
2            20                      2                   1
3            30                      3                    2
4            40                      4                    4

A and B are related such that Col1 is the foreign key for Table A.

The way I want the query to work is that if in B , col1 <> Parent Col then the Amt, ( which is in table A for Col1 ) should sum up. ie results should be like

Col1         (sum of amt)
-------         -----------------
   1               10+20+30=60  (since '2' is a child of '1' and '3' is a
child '2' and '1' is a main parent)
   4                40                     (only since it is not the child
of any parent row)

Can some one help me!!!!!!!!!!

Thanks
Deepa
Deepar_at_aeimusic.com Received on Wed Mar 31 1999 - 22:14:09 CEST

Original text of this message