Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> SQL to connect by and order by at the same time
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
![]() |
![]() |