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

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

Extracting Parent Model from Nested Sets Model

From: Flavio Botelho <nuncanada_at_ig.com.br>
Date: 20 Jan 2003 21:04:48 -0800
Message-ID: <de0df942.0301202104.9bb8e47@posting.google.com>


As i had seen an outer join as the only suggestion out there i wondered if there weren´t a faster query for tables with a lot of nested sets.

This is for mysql, but seems to be translatable to other dbs(?):

 SELECT @next_brother:=33; //<- left + 1 for a specific parent  SELECT @next_brother:=
   CASE WHEN left >= @next_brother

     THEN right+1 
     ELSE @next_brother 

   END, name
   FROM categories
   ORDER BY left;

Nuncanada Received on Mon Jan 20 2003 - 23:04:48 CST

Original text of this message

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