Jim -

There are two conditions to test for:

1) Is the minimum contained in a defined vessel?
2) Is the maximum contained in a defined vessel?

Your rule answers these questions and it works with some additional parens:

exists (SELECT YearNo from TagLimit t2 
         WHERE (t2.Fishery = TagLimit.Fishery)
           AND (t2.YearNo = TagLimit.YearNo)
           AND (   (TagLimit.MinSize between T2.MinSize and T2.MaxSize) 
                OR (TagLimit.MaxSize between T2.MinSize and T2.MaxSize)))

I tested it here and it works so if you are still having a problem please
get in touch privately.

Bernie
=======================================
At 03:20 PM 1/15/2002 -0900, you wrote:
>I am trying to craft a rule and can not get it. I have a table:
> TagLimits
>     For a fishery, and year, the number of crab pots allowed,
>     which depends on the size of the vessel.
>Columns and proper entries:
>YearNo Fishery MinSize MaxSize NoPots
> 2002    KR       0.0    125.4   50
> 2002    KR       125.5  999.0   75
>
>The important idea is that for a given fishery and year the range of sizes
in successive rows not overlap. I would like to prevent the following third row:
> 2002    KR        0.0   999.0   44
>
>This one looks good but will not load - it gets an error message: This
Rule's WHERE Clause is invalid
>rule 'This Vessel Size in this Fishery is Keyed'+
>  for TagLimit FAILS+
>  WHERE exist (select (YearNo) from TagLimit t2 WHERE+
>  t2.Fishery = TagLimit.Fishery and t2.YearNo = TagLimit.YearNo+
>  and (TagLimit.MinSize between T2.MinSize and T2.MaxSize or
>  TagLimit.MaxSize between T2.MinSize and T2.MaxSize) )
>
>Any ideas gratefully appreciated?
>
>It is mid-January, clear blue sky(first clear day in many weeks), no wind
(first in weeks), mid-40's (6-7 degrees C) and a crab fishery started today
- second in a decade!
>
>Jim Blackburn
>Kodiak
>================================================
>TO SEE MESSAGE POSTING GUIDELINES:
>Send a plain text email to [EMAIL PROTECTED]
>In the message body, put just two words: INTRO rbase-l
>================================================
>TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
>In the message body, put just two words: UNSUBSCRIBE rbase-l
>

================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l

Reply via email to