Subject Re: [IBO] Possible Bug in Parser: Sub-Selects with Integer and Date Fields In Firebird
Author Svein Erling Tysvaer
At 11:24 10.07.2003 -0300, you wrote:
>Select Count(Distinct NumLote) as Total,
>(Select Count(distinct NumLote) from Co_Lct Where ((CodEmpresa=:CodEmpresa)
>and (Identificacao starting with 'LA'))) as TotLote
>from Co_Lct where ((CodEmpresa=:CodEmpresa) and (Data between :DataInicial
>and :DataFinal))

I think I would have changed this to

Select Count(Distinct NumLote) as Total,
(Select Count(distinct B.NumLote) from Co_Lct B Where
((B.CodEmpresa=A.CodEmpresa)
and (B.Identificacao starting with 'LA'))) as TotLote
from Co_Lct A where ((CodEmpresa=:CodEmpresa) and (Data between :DataInicial
and :DataFinal))

It surprises me that Firebird 1.5 lets you do your query, since I find it
ambiguous allowing you to reference CodEmpresa and Identificacao in the
where clause of the subselect without qualifying them.

Set