Subject | Re: [ib-support] Select Count(*) strange Result |
---|---|
Author | Arno Brinkman |
Post date | 2002-12-17T13:45Z |
Hi,
number of distinct rows from WBG.VERKAUFSKONTO and A.UMSATZSTEUERCODE. Add
to Count(*) to your first query and you'll see.
So there's nothing wrong :-)
Regards,
Arno
> at the first glance, Firebird 1.0 has as strange result from a(A.BUCHUNGSGRUPPE=WBG.WARENBUCHUNGSGRUPPE)
> count(*) Statement:
>
> The following sql fetches exactly 1 row as expected:
>
> select
> WBG.VERKAUFSKONTO
> , A.UMSATZSTEUERCODE
> , Sum(BBZ.BRUTTOBETRAG) as BRUTTOBET
> , Sum(BBZ.NETTOBETRAG) as NETTOBET
> , Sum(BBZ.MWSTBETRAG) as MWSTBET
> FROM BBELEGZEILEN BBZ
> JOIN ARTIKEL A on (BBZ.ARTIKELNR=A.ARTIKELNR)
> JOIN WARENBUCHUNGSGRUPPEN WBG on
> where BELEGID=8(A.BUCHUNGSGRUPPE=WBG.WARENBUCHUNGSGRUPPE)
> GROUP BY WBG.VERKAUFSKONTO, A.UMSATZSTEUERCODE
> HAVING Sum(BBZ.NETTOBETRAG) > 0
>
> But the corresponding counting select returns 16:
>
> select count(*)
> FROM BBELEGZEILEN BBZ
> JOIN ARTIKEL A on (BBZ.ARTIKELNR=A.ARTIKELNR)
> JOIN WARENBUCHUNGSGRUPPEN WBG on
> where BELEGID=8Count(*) returns the number of rows that are "grouped". In your case the
> GROUP BY WBG.VERKAUFSKONTO, A.UMSATZSTEUERCODE
> HAVING Sum(BBZ.NETTOBETRAG) > 0
>
> Any explanation/help for me?
number of distinct rows from WBG.VERKAUFSKONTO and A.UMSATZSTEUERCODE. Add
to Count(*) to your first query and you'll see.
So there's nothing wrong :-)
Regards,
Arno