Subject question about TIB_Query with KeySource set
Author Mihai Chezan
Hi,

I have a TIB_Query set as a lookup query and looks something like
this:
select
t1.den_t1,
t1.id_t1
from
t1
inner join t2
on t1.id_t1=t2.id_t1
where
t2.id_x1 = 1
and t2.id_x2 = 2

and the KeyLinks
t1.id_1=table_that_uses_this_lookup_query.id_t1

and KeyDescLinks
t1.den_t1=den_t1

When I run the program I get:
Multiple rows in singleton fetch

Check KeyLinks and JoinLinks properties

select
t1.den_t1,
t1.id_t1
from
t1
inner join t2
on t1.id_t1=t2.id_t1
WHERE t1.id_t1=? /* BIND_0 */


Question: shouldn't the query look something like this:
select
t1.den_t1,
t1.id_t1
from
t1
inner join t2
on t1.id_t1=t2.id_t1
WHERE
t2.id_x1 = 1
and t2.id_x2 = 2
and t1.id_t1=? /* BIND_0 */

The thing is that KeyLinks is true (is a pk) only if you have:
WHERE
t2.id_x1 = 1
and t2.id_x2 = 2