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 -> Re: Summing hierarchical data SQL

Re: Summing hierarchical data SQL

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Wed, 4 Oct 2006 21:04:56 +0200
Message-ID: <452405d9$0$29222$426a74cc@news.free.fr>

"Mike C" <michaeljc70_at_hotmail.com> a écrit dans le message de news: 1159986837.764064.22880_at_m73g2000cwd.googlegroups.com...
| If I have a table or query that returns hierarchical data, how can I
| sum it? There are counts only at the lowest level and I want to roll
| it up to the parent levels. Here is an example:
|
|
| Level ID Name Parent Frequency
| 1 1 USA NULL
| 2 2 CA 1
| 3 3 LA 2 10
| 3 4 SF 2 15
| 2 5 IL 1
| 3 6 Chicago 5 5
|
|
| I want to get this:
|
| Level ID Name Parent Frequency
| 1 1 USA NULL 30
| 2 2 CA 1 25
| 3 3 LA 2 10
| 3 4 SF 2 15
| 2 5 IL 1 5
| 3 6 Chicago 5 5
|

Have a look at CONNECT BY clause.

Regards
Michel Cadot Received on Wed Oct 04 2006 - 14:04:56 CDT

Original text of this message

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