SQL query question

Charles Yeomans yeomans at desuetude.com
Thu Feb 12 18:01:32 CST 2004


On Feb 12, 2004, at 5:39 PM, Ruslan Zasukhin wrote:

> on 2/13/04 12:36 AM, Charles Yeomans at yeomans at desuetude.com wrote:
>
>> The following query results in error 612.
>> SELECT M1.matter_name FROM Matters M1, Matters M2 WHERE M1.leftIndex
>> BETWEEN M2.leftIndex AND M2.rightIndex AND M2.matter_name='ICI'
>>
>> Is such a query not possible in the current version of Valentina?
>
> But where is your link condition Charles?
>
> It seems you have self-recursion yes?
> With ObjectPtr this works
>

I am trying something different.  There is another model for 
representing hierarchical data in a table, based on nested sets.  The 
idea is this.  A "set" is an interval [a, b].  To each record I 
associate such a set.  Then I say that record X is a child of record Y 
if the interval associated to record X is contained in the interval 
associated to record Y; this clearly defines a partial ordering on the 
records.  I store the set associated to each record in ULong fields 
leftIndex and rightIndex.

With this scheme, the above query should return the record whose 
matter_name is 'ICI', plus all of its descendants.

Charles Yeomans



More information about the Valentina mailing list