Subject Re: [IBO] Column does not belong to referenced table - Bug report
Author Svein Erling Tysvaer
Your original query did not alias the subquery, I think that's what made
Helen say it isn't legal SQL. However, the statement below does alias
the subquery and seems like legal SQL. If it is reproducable in the last
beta version of IBO, I'm sure Jason would be happy to receive a simple
test case (a test case that either uses tables that are available to all
or that builds the tables on startup) clearly showing your problem (then
he can tell whether it is actually an error or some misunderstanding).

I'm surprised that it seems like the below SQL doesn't generate the PK
of folha as its KEYLINKS, but tries to go RDB$DB_KEY. The only not quite
normal with the SQL, is that the subselect selects C.pk_tb_fpg_cod and
not * or a constant, but that shouldn't matter.

Set

omar l m rosa wrote:
> SQL.Strings = (
> 'select f.*'
> ' from folha f'
> ' where f.pk_funcionarios = :pk_funcionarios and'
> ' f.mes_referencia = :mes_referencia and'
> ' exists(select C.pk_tb_fpg_cod'
> ' from tb_fpg_cod C'
> ' where C.vencim_desc in (4,7) and'
> ' C.pk_tb_fpg_cod = f.pk_tb_fpg_cod)')
>
> Now, if I remove all alias and reference explicity the ambibuous field name=
> "FOLHA.pk_tb_fpg_cod" all runs OK!
>
> Thanks for your attention!
> Helen Borrie said has an error in sql sentence! I don't know where!
>
> bai!
> omar