Subject Re: [IBO] sql quesiton
Author Svein Erling Tysvaer
I think your KeyLinks should be the following two lines:

i.entity_id
a.address_id

From your description of your error, I assume you forgot the last line.

HTH,
Set

Peter Lee wrote:
> Hello,
>
> Using Delphi 6 and FB1.5, IBO4.5Ai I have this query that works fine -
> I get a list of people as expected. However, with some searches,
> using TIB_Query.locate, I get an error 'Multiple rows in singleton
> fetch' - Check KeyLinks and JoinLinks properties.
>
> It seems to happen when a particular individual has multiple
> addresses. The locate statement only has one field - searching on
> last name.
>
> Thanks,
>
> Peter Lee
>
> ===
>
> qIndividual.locate(fieldText, VarArrayFromStrings(fieldValues),
> [lopCaseInsensitive, lopPartialKey]);
>
> ===
>
> select
> i.entity_id,
> i.name_last,
> i.name_first,
> i.type_customer,
> i.type_general,
> a.address_id,
> a.city,
> a.state,
> a.main_address,
> a.country_iso,
> co.country_name,
> i.ph_main,
> i.ph_mobile,
> i.name_company
> from individual i
> left outer join address a on i.entity_id = a.entity_id
> left outer join country co on co.iso = a.country_iso
> where (a.main_address = 1 or a.main_address is null) and
> (i.type_general = 1)
> order by UPPER(i.name_last), UPPER(i.name_first), UPPER(co.country_name)