Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: Extracting Parent Model from Nested Sets Model

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@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 @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 @next_brother to this new child and then the HAVING would filter to only those childs which have @next_brother equal to their right...

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

Nuncanada Received on Wed Jan 22 2003 - 18:52:49 CST

Original text of this message

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