Subject Re: [firebird-support] fb 1.0 => 1.5 having doesnt work any more
Author Arno Brinkman
Hi Richard,

> in Firebird 1.0 we use this and it works fine:
>
> Select ZiBelegNr, Min(SplitDate) as "Splitter-Datum" from RsvKat
> group by ZiBelegNr
> having (SPLITDATE is not null)
>
> I want those ZiBelegNr entries that have for the "ZiBelegNr" only
> entries with Splitdate not null.
> e.g.
> ZiBelegNr Splitdate
> 1 08/08/2003
> 1 NULL
> 2 08/08/2003
> 3 NULL
> ZiBelegNr=2 is what i want to get.
>
> But in fb1.5 it doesnt work (error). I need fb 1.5 for windows 2003.
> I tried
> Select ZiBelegNr, Min(SplitDate) as "Splitter-Datum" from RsvKat
> group by ZiBelegNr, splitdate
> having (SPLITDATE is not null)
>
> That SQL works, but i get the wrong result.
>
> Any Idea what to do

Yes, put the comparisions at the place they belong.
Move your evaluation from the having to the where clause :

SELECT
ZiBelegNr,
Min(SplitDate) as "Splitter-Datum"
FROM
RsvKat
WHERE
SplitDate IS NOT NULL
GROUP BY
ZiBelegNr


Regards,
Arno Brinkman
ABVisie

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird links :
http://www.firebirdsql.com
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/


Nederlandse firebird nieuwsgroep :
news://80.126.130.81