Subject Re: [IBO] Same table Lookups
Author Geoff Worboys
> The problem I strike with the KeyLinks for the lookup
> query is trying to set
> CLIENTS.SUPERVISORNO=CLIENTS.CLIENTNO, which ain't allowed!

This definition should be OK in KeyLinks. This definition is purely
for IBOs information, it does not get used directly in any SQL. The
left side is the key field in the lookup dataset, the right side is
the corresponding (foreign key) in the main/destination dataset.

Also, you only need the table names (in keylinks and keydesclinks)
when the queries contain multiple relationships. You always need the
table names in masterlinks to enable search sql to be built (if you
are not using search master/detail search then it does not matter
AFAICT).

The real problem comes if you are using KeyDescLinks to enable the
display of the selection in a grid (or for use with my LookupEnh
control). The solution is to alias both the tables.

SELECT A.FIELDA,
(SELECT FIELDB FROM TABLEB B
WHERE B.KEYFIELD=A.KEYFIELD) AS FIELDB
FROM TABLEA A


HTH

Geoff Worboys
Telesis Computing