Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Ordering Hierarchical Queries

Re: Ordering Hierarchical Queries

From: Andrew Barnett <nobody_at_spamandeggs.bp.com>
Date: 1998/03/25
Message-ID: <01bd583a$8e20bea0$8c0564a1@azmelw1358.mel.az.bp.com>#1/1

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>...

> 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.
>
>
>
Received on Wed Mar 25 1998 - 00:00:00 CST

Original text of this message

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