From: Hallgeir on
Thanks!

"Stefan Hoffmann" wrote:

> hi,
>
> On 10.03.2010 14:28, Hallgeir wrote:
> > Hi guys, your self join solutions returns correctly records, but it's not
> > sorted the way I was looking for. My table contains a kind of nesting where
> > one record points back to another one. I want the resulting query to start
> > with the latest record and then continue with the record PreviousId is
> > pointing to, and so on. Previous leader should always be leader on the record
> > below.
> Why haven't you posted this little piece of information in the first
> message?
>
> Google for 'adjacency list'...
>
> Basically you cannot do this in a single or simple query. The most
> common approach here is to add an extra column tracking the level of
> your node. The level itself can be calculated either using recursion for
> the entire tree or by a simple lookup: parent level + 1 when inserting
> or moving the node.
>
Sorry that I did not explain it well enough in my first post. Thank you for
your answear. This was the kind of answear I was looking for. Anything can be
solved, but obviously I can make it easier for my self designing a better
database.