Re: Nested sort, trying again
- From: "vc" <boston103@xxxxxxxxxxx>
- Date: 30 Sep 2005 05:03:49 -0700
Bob Stearns wrote:
....
> In this case the tree is sorted in the order I want to present it to my
> users. Consider the tree z(y(x,w),v(y(t,s))) which would have a similar
> representation to the first on but which I wish to present to my users as:
>
> z
> v
> u
> s
> t
> y
> w
> x
> The question is: Is there an easy (relatively) way to produce this sort
> without a recursive sql user defined function?
No, you cannot do that in the standard SQL even resorting to tricks
like nested intervals or some such. What you want to do is the a
DFS(depth-first search) with siblings ordered by their names.
Oracle's proprietary 'connect by' will do that easily with the usual
(child, parent) representation. DB2's recursive query however won't
because it performs a BFS (breadth-first search.
.
- References:
- Nested sort, trying again
- From: Bob Stearns
- Re: Nested sort, trying again
- From: mAsterdam
- Nested sort, trying again
- Prev by Date: Re: Database design, Keys and some other things
- Next by Date: Functional Dependencies?
- Previous by thread: Re: Nested sort, trying again
- Next by thread: Re: Nested sort, trying again
- Index(es):
Relevant Pages
|