Subject How should I set masterlinks property, using Select ... union ...Select
Author Andrei Luís
Hello,

I have the following SQL in a TIB_Query:

select Cast(wProduto_id as integer) Produto_id,
Cast(wVendedor_id as integer) Vendedor_id,
Cast(wVendedor as varchar(60)) Vendedor,
Cast(wSaldo as Integer) Estoque
from sp_localizacao_estoque

union all

Select Cast(registro_id as Integer),
Cast( 0 as Integer),
Cast('DEPÓSITO' as VarChar(60)),
Cast(estoque as Integer)
from produtos

This is working fine, tested in IBExpert.


This is a detail query, and I need to link this through masterlinks in
my master query:

SELECT P.REGISTRO_ID
, P.PRODUTO
, P.ESTOQUE
FROM PRODUTOS P


I never used masterlinks when using UNION in one of the queries. I
tried a couple of statements, and none of them works.

Can anyone help me?

registro_id is the PK of produtos and wProduto_ID is FK of
sp_localizacao_estoque

[]s and Regards
Andrei

Win XP Pro + D2006 Pro + FB 1.5.4 + IBO 4.7.16