Subject | Re[3]: [IBO] Possible Bug in Parser: Sub-Selects with Integer and Date Fields In Firebird |
---|---|
Author | Eduardo Jedliczka |
Post date | 2003-07-10T16:41:55Z |
Helen, the truth is I was writed this select in firebird 1.5 and I need
re-write for FB 1.0 - and IBO result error
Select Substring(Identificacao from 1 for 2), Count( Distinct NumLote) as
Total From Co_LCT
where CodEmpresa=:Empresa
Group By 1
Order by 1
but in FB 1.0 I re-write as:
Select Count(Distinct X.NumLote) as Total,
(Select Count(distinct A.NumLote) from Co_Lct A Where
A.CodEmpresa=:CodEmpresa and A.Identificacao starting with 'LA' and A.Data
between :DataInicial and :DataFinal) as TotLA,
(Select Count(distinct B.NumLote) from Co_Lct B Where
B.CodEmpresa=:CodEmpresa and B.Identificacao starting with 'RA' and B.Data
between :DataInicial and :DataFinal) as TotRa,
(Select Count(distinct C.NumLote) from Co_Lct C Where
C.CodEmpresa=:CodEmpresa and C.Identificacao starting with 'CA' and C.Data
between :DataInicial and :DataFinal) as TotCa,
(Select Count(distinct D.NumLote) from Co_Lct D Where
D.CodEmpresa=:CodEmpresa and D.Identificacao starting with 'FI' and D.Data
between :DataInicial and :DataFinal) as TotFi,
(Select Count(distinct E.NumLote) from Co_Lct E Where
E.CodEmpresa=:CodEmpresa and E.Identificacao starting with 'FO' and E.Data
between :DataInicial and :DataFinal) as TotFo,
(Select Count(distinct F.NumLote) from Co_Lct F Where
F.CodEmpresa=:CodEmpresa and F.Identificacao starting with 'LP' and F.Data
between :DataInicial and :DataFinal) as TotLp,
(Select Count(distinct G.NumLote) from Co_Lct G Where
G.CodEmpresa=:CodEmpresa and G.Identificacao starting with 'DE' and G.Data
between :DataInicial and :DataFinal) as TotDe
from Co_Lct X where (X.CodEmpresa=:CodEmpresa and X.Data between
:DataInicial and :DataFinal)
Ok it´s very confuse, but when I simplify like this...
Select Count(Distinct X.NumLote) as Total,
(Select Count(distinct A.NumLote) from Co_Lct A Where
A.CodEmpresa=:CodEmpresa and A.Identificacao starting with 'LA') as TotLA,
from Co_Lct X where (X.CodEmpresa=:CodEmpresa and X.Data between
:DataInicial and :DataFinal)
the error continue: (Only when I pass the parameters.. )
thanks,
=======================
Eduardo Jedliczka
Gerasoft - Informática
Apucarana - PR - Brasil
=======================
re-write for FB 1.0 - and IBO result error
Select Substring(Identificacao from 1 for 2), Count( Distinct NumLote) as
Total From Co_LCT
where CodEmpresa=:Empresa
Group By 1
Order by 1
but in FB 1.0 I re-write as:
Select Count(Distinct X.NumLote) as Total,
(Select Count(distinct A.NumLote) from Co_Lct A Where
A.CodEmpresa=:CodEmpresa and A.Identificacao starting with 'LA' and A.Data
between :DataInicial and :DataFinal) as TotLA,
(Select Count(distinct B.NumLote) from Co_Lct B Where
B.CodEmpresa=:CodEmpresa and B.Identificacao starting with 'RA' and B.Data
between :DataInicial and :DataFinal) as TotRa,
(Select Count(distinct C.NumLote) from Co_Lct C Where
C.CodEmpresa=:CodEmpresa and C.Identificacao starting with 'CA' and C.Data
between :DataInicial and :DataFinal) as TotCa,
(Select Count(distinct D.NumLote) from Co_Lct D Where
D.CodEmpresa=:CodEmpresa and D.Identificacao starting with 'FI' and D.Data
between :DataInicial and :DataFinal) as TotFi,
(Select Count(distinct E.NumLote) from Co_Lct E Where
E.CodEmpresa=:CodEmpresa and E.Identificacao starting with 'FO' and E.Data
between :DataInicial and :DataFinal) as TotFo,
(Select Count(distinct F.NumLote) from Co_Lct F Where
F.CodEmpresa=:CodEmpresa and F.Identificacao starting with 'LP' and F.Data
between :DataInicial and :DataFinal) as TotLp,
(Select Count(distinct G.NumLote) from Co_Lct G Where
G.CodEmpresa=:CodEmpresa and G.Identificacao starting with 'DE' and G.Data
between :DataInicial and :DataFinal) as TotDe
from Co_Lct X where (X.CodEmpresa=:CodEmpresa and X.Data between
:DataInicial and :DataFinal)
Ok it´s very confuse, but when I simplify like this...
Select Count(Distinct X.NumLote) as Total,
(Select Count(distinct A.NumLote) from Co_Lct A Where
A.CodEmpresa=:CodEmpresa and A.Identificacao starting with 'LA') as TotLA,
from Co_Lct X where (X.CodEmpresa=:CodEmpresa and X.Data between
:DataInicial and :DataFinal)
the error continue: (Only when I pass the parameters.. )
thanks,
=======================
Eduardo Jedliczka
Gerasoft - Informática
Apucarana - PR - Brasil
=======================
----- Original Message -----
From: "Eduardo Jedliczka" <eduardo@...>
To: <IBObjects@yahoogroups.com>
Sent: Thursday, July 10, 2003 1:07 PM
Subject: Re: [IBO] Possible Bug in Parser: Sub-Selects with Integer and Date
Fields In Firebird
> Helen Borrie and Svein,
>
> Thanks for answer.
>
> Well, I know the risk of ambiguous... But setting different aliases for
> table CO_LCT, for example Co_LCT A and Co_LCT B, the error is the same.
:-(
>
> =======================
> Eduardo Jedliczka
> Gerasoft - Informática
> Apucarana - PR - Brasil
> =======================
>
> ----- Original Message -----
> From: "Svein Erling Tysvaer" <svein.erling.tysvaer@...>
> To: <IBObjects@yahoogroups.com>
> Sent: Thursday, July 10, 2003 12:05 PM
> Subject: Re: [IBO] Possible Bug in Parser: Sub-Selects with Integer and
Date
> Fields In Firebird
>
>
> > 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
> >
> >
> >
> >
>
___________________________________________________________________________
> > IB Objects - direct, complete, custom connectivity to Firebird or
> InterBase
> > without the need for BDE, ODBC or any other layer.
> >
>
___________________________________________________________________________
> > http://www.ibobjects.com - your IBO community resource for Tech Info
> papers,
> > keyword-searchable FAQ, community code contributions and more !
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
> >
> >
>
>
>
>
___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or
InterBase
> without the need for BDE, ODBC or any other layer.
>
___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info
papers,
> keyword-searchable FAQ, community code contributions and more !
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>