Subject Re: [IBO] Updatable TIB_Cursor
Author achidan
Hi Helen

Thank you for your reply!

> At 04:22 PM 1/03/2004 +0000, you wrote:
> >Hi!
> >
> >With IBObjects 4.3Aa I have the following problem. I have a TIB_Cursor
> >with a SQL
> >
> >SELECT * FROM Table1 join Table2 on Table1.ID = Table2.ID
> >WHERE Table1.ID = :pID
> The query is ambiguous.
> select table1.* from table1
> join table2 on =

I and my Firebird 1.5 don't find this query ambigous (no error from
Firebird). Also your query gives a differnt returnset than my query!
My query includes all the fields of Table2 too.

> >Anyone has an idea, what I'm doing wrong?
> First, don't write ambiguous joins.
> Second, don't use joins that should be WHERE criteria.
> select table1.* from table1
> where exists(
> select from table2
> where =

No, that's different. I want

select table1.*, table2.* from .....

so this exist clause doesn't work I think.

> All of the above. A joined set is not a naturally updatable set.
If the
> keylinks are correct and it is possible to target each row in one table
> uniquely then you can use KeyRelation to signal that table. But
> KeyRelation can't work if the query is ambiguous.

Okay, I also thought about the problem, that KeyLinks cannot be
resolved properly, because of field id, which isn't unique. So I used
another version of this query:

select Table2.Field21, Table2.Field22, Table1.*
from table1 join table2 .....

Field21 and Field22 are unique within Table1.

Setting KeyLinks and KeyRelation as described in the mail before. But
this was still not helping to resolve the KeyLinks correct.

I know that I could write EditSQL but I would like to avoid in this
situation because IBObjects has quite clever logic inside. The
Update-Statement is only updating the field with changed values, etc.