Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Ordering Hierarchical Queries
you can do
select * from
(select parent, child, sort_order, level
from relation
connect by parent = prior child start with parent = 'A' )
order by sort_order;
but you wouldn't be able to see the relationship between parents and children, so I wonder why you'd want to do it.
-- Andrew - Wizzard barnetaj_at_bp.com Junmin Lin <linjm_at_guomai.sh.cn> wrote in article <6favuq$8rq$1_at_www.clinux.ml.org>...Received on Wed Mar 25 1998 - 00:00:00 CST
> Hi,
>
> I have a question about hierarchical queries.
>
> Suppose I have a table:
>
> PARENT NOT NULL VARCHAR2(10)
> CHILD NOT NULL VARCHAR2(10)
> SORT_ORDER NUMBER(5)
>
> I want to do a hierachical query, I could do:
>
> select parent, child, sort_order, level
> from relation
> connect by parent = prior child start with parent = 'A' ;
>
> But, if I want the out put sorted via sort_order and at the same time
> preseved the level.
>
> How should I do it?
>
> Thanks in advance.
>
>
> Lin Junmin.
>
>
>