Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to Sort Subset of Hierarchical Query
create index parent_child on Table(parent,child);
select /*+index(table parent_child) */
rpad(' ',level,' ')||child
from table
connect by prior child=parent
Mark Malakanov
Allen <allen_at_ms15.hinet.net> wrote in message
news:7t0rvr$3vu_at_netnews.hinet.net...
> Hi,
> Can anyone help me how to sort subset when using
> Oracle Hierarchical Query, For Example:
>
> Table:
> Parent Child Child_Seq
> Contains:
> aaa bbb 300
> bbb ccc 200
> bbb ddd 100
> bbb eee 240
> aaa kkk 210
> SQL Statement:
> select parent, child, child_seq from TABLE start with parent = 'aaa'
> connect by prior child=parent.
> Output:
> aaa bbb 300
> bbb ccc 200
> bbb ddd 100
> bbb eee 240
> aaa kkk 210
>
> But I hope that I can get another result, if same parent, I need to sort
by
> child_seq:
> aaa bbb 300
> bbb ddd 100
> bbb ccc 200
> bbb eee 240
> aaa kkk 210
>
>
>
>
>
>
>
>
>
Received on Thu Sep 30 1999 - 21:25:56 CDT
![]() |
![]() |