Subject KeyLinks and Multiple rows in singleton fetch
Author Guido Klapperich
I have a TIB_Query with the SQL-Statement

select PCID,
PCPAID,
PCMPID,
PCNR,
PCNAME1,
(select PANAME from PRODUCTAREAS where
PAID=PRODUCTS.PCPAID) as PANAME,
(select MPNAME from MAINPRODUCTGROUPS where
MPID=PRODUCTS.PCMPID) as MPNAME,
PCTARGETRELEASEDATE,
PCLISTPRICE,
PCRRP,
PCDAYONE,
PCMINORDERQUANTITY
from PRODUCTS join ORDERITEMSTABS_MP on PCMPID=OMMPID
where OMOAID=3
and PCACTIVE=1

and the KeyLinks

PRODUCTS.PCID=ORPCID

and the KeySource is assigned.
This Query is used a Lookup-Query to select a product. When I open the
query, I get the following error

Multiple rows in singleton fetch

Check KeyLinks and JoinLinks properties

select PCID,
PCPAID,
PCMPID,
PCNR,
PCNAME1,
(select PANAME from PRODUCTAREAS where
PAID=PRODUCTS.PCPAID) as PANAME,
(select MPNAME from MAINPRODUCTGROUPS where
MPID=PRODUCTS.PCMPID) as MPNAME,
PCTARGETRELEASEDATE,
PCLISTPRICE,
PCRRP,
PCDAYONE,
PCMINORDERQUANTITY
from PRODUCTS join ORDERITEMSTABS_MP on PCMPID=OMMPID
WHERE ( PRODUCTS.PCID=? /* BIND_0 */ )

in the function TIB_BindingCursor.QuickFetch in IB_Components row 29675

That's right, because without the where-part

where OMOAID=3
and PCACTIVE=1

from the SQL-Statement, the result will contain double products. I can
solve the problem with using distinct, but I wonder, why the where-part
from my query is ignored in this case.

Regards

Guido