Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Summing hierarchical data SQL
I've already used the connect by to get the data in this format....
Michel Cadot wrote:
> "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:21:47 CDT
![]() |
![]() |