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 -> SQL to connect by and order by at the same time

SQL to connect by and order by at the same time

From: Clayton Nash <clayton_at_ionicom.co.uk>
Date: Thu, 29 Nov 2001 13:22:36 GMT
Message-ID: <3c063687.342921184@news.easynet.co.uk>


Hi,

I have a hierarchial set of data in a table which I'm retrieving with a connect by query -- something like

SELECT LEVEL, component_id, title FROM COMPONENT_DATA

    START WITH component_id = 1
    CONNECT BY PRIOR component_id = parent_component_id;

The issue I have is that I'd like to have teh list sorted by title as well. If I do
SELECT LEVEL, component_id, title FROM COMPONENT_DATA

    START WITH component_id = 1
    CONNECT BY PRIOR component_id = parent_component_id

        ORDER BY title;

Then the list is sorted _after_ the hierarchial connect. This obviously isn't what I want -- I want the sorts to take place within each branch.

Is there any easy way to do this?

Thanks,

Clayton
PS: Oracle 8.1.5 -- query is in a PL/SQL procedure -- Linux 6.2 Received on Thu Nov 29 2001 - 07:22:36 CST

Original text of this message

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