SQL query question

Ruslan Zasukhin sunshine at public.kherson.ua
Fri Feb 13 01:20:57 CST 2004


on 2/13/04 1:01 AM, Charles Yeomans at yeomans at desuetude.com wrote:

> 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].

Aha.

You do 
    
    WHERE M1.leftIndex BETWEEN M2.leftIndex AND M2.rightIndex
    
In any case you must at first make JOIN on 2 tables,
Before use fields from both.

And yes, I afraid such query will not work.


> 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.

Interesting.

I have never it seems hear about such kind if relation :-)


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

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list