Re: Extracting Parent Model from Nested Sets Model

From: Flavio Botelho <nuncanada_at_ig.com.br>
Date: 22 Jan 2003 16:52:49 -0800
Message-ID: <de0df942.0301221652.2fa88ca8_at_posting.google.com>


71062.1056_at_compuserve.com (--CELKO--) wrote in message news:<c0d87ec0.0301221108.10e5d0f1_at_posting.google.com>...
> >> Does that work in SQL Server? <<
>
> No. The adjacency list model would have a (parent, child) table as a
> result. This query simply gives meaningless numbers. Yout query does
> not translate into SQL.
>
> What is the logic? Is there a looop hidden in the syntax?

The _at_next_brother stores the right from the last direct child, so whatever left comes right after this right is the next direct child. So you update the _at_next_brother to this new child and then the HAVING would filter to only those childs which have _at_next_brother equal to their right...

It works in mysql... But it requires you´re able to change _at_next_brother´s value inside the select statement...

Nuncanada Received on Thu Jan 23 2003 - 01:52:49 CET

Original text of this message