Re: Getting a grip on nested intervals and matrix encoding

From: creecode <creecode_at_gmail.com>
Date: Sat, 21 Aug 2010 12:16:45 -0700 (PDT)
Message-ID: <a5946c1b-3294-48e4-b7d6-33728df71c5f_at_p22g2000pre.googlegroups.com>


Hello Vadim,

Sorry for delayed reply.

On Aug 16, 12:52 pm, Vadim Tropashko <vadim..._at_gmail.com> wrote:

> The records ordered by idx_left, idx_right desc. I assume you want a
> query that when given a node in a hierarchy fetches the next node
> according to the ordering. I found that this query is a mess due to
> composite ordering key. Therefore, it makes sense to order the values
> by a scalar, something like (a11-a12)/(a21-a22)*10000000000 - a11/a21
>
> Here is the full query:
>
> with OrderedHier as ( select name, (a11-a12)/(a21-a22)*10000000000 -
> a11/a21 pos from hierarchy )
> SELECT h.name FROM OrderedHier h, OrderedHier node
> where node.name = 'BLAKE'
> and h.pos > node.pos
> and not exists (
>  SELECT * FROM OrderedHier hh
>  where h.pos > hh.pos
>  and hh.pos > node.pos
> )
> ;
>
> fetching ALLEN. (Tested everything between KING and BLAKE)

Excellent! Seems to work great! Thank you so much!

Toodle-loooooooooooooo
creecode Received on Sat Aug 21 2010 - 21:16:45 CEST

Original text of this message