SQL query question

Ruslan Zasukhin sunshine at public.kherson.ua
Fri Feb 13 01:22:31 CST 2004


on 2/13/04 1:01 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.

IF you search childs of just ONE record,
Then I think you can ask only ONE table on BETWEEN

May be you need to use

    fld IN SUBSELECT

For you task

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