join question

Charles Yeomans yeomans at desuetude.com
Wed Jul 16 12:18:13 CDT 2003


On Wednesday, July 16, 2003, at 01:11 AM, Ruslan Zasukhin wrote:

> on 7/16/03 3:08, Charles Yeomans at yeomans at desuetude.com wrote:
>
>> When I pass the query below to V4Rb, I get back error 616.  Anyone see
>> why?
>>
>> Charles Yeomans
>>
> SELECT
>     Decisions.caption,
>     Decisions.cite,
>     Decisions.year,
>     Courts.abbr,
>     Decisions.lawstring,
>     Decisions.RecID
> FROM
>     Decisions,
>     Courts,
>     LDJoin LDJoin1,
>     LDJoin LDJoin2
> WHERE
>     Decisions.RecID = LDJoin.decision_ptr AND
>     Decisions.RecID = LDJoin2.decision_ptr
>    AND
>     LDJoin.law_ptr = 18 AND LDJoin2.law_ptr = 4
>
> ---------------------------
> You have 4 tables, so you must have 3 link conditions.
> I see only 2.
> There is no link to Courts table.

There is a VObjectPtr field in Decisions pointing back to Courts.

>
>
> Charles, please remind me. Valentina now can work with condition
>
>     WHERE ObjectPtr = 5

Apparently so.
>
> I recall that was problem with this. It was need wrap ObjectPtr by 
> method.
> Only this did work
>
>     WHERE ObjectPtr = RecID
>
> May be I already fix that. I do not remember.
> For you these conditions work? Then this is great!
>
>     LDJoin.law_ptr = 18 AND LDJoin2.law_ptr = 4

It turns out that the problem was that I was using LDJoin.law_ptr 
instead of LDJoin1.law_ptr (LDJoin1 = alias for LDJoin).  Once I fixed 
this throughout the SQL statement, it executed perfectly.

Thanks Claudius for your very nice trick.

Charles Yeomans



More information about the Valentina mailing list