Subject | Re: SQL result, exclude NULL values. |
---|---|
Author | Svein Erling Tysvær |
Post date | 2005-06-29T11:05:18Z |
Hi Michael,
you could add a WHERE EXISTS before your GROUP BY clause.
Set
you could add a WHERE EXISTS before your GROUP BY clause.
Set
--- In firebird-support@yahoogroups.com, "Michael Vilhelmsen" wrote:
> Hi
>
> I have this SQL statement.
>
> SELECT
> VARER.PLU_NR,
> VARER_DETAIL.ANTALSTK,
> VARER_DETAIL.AFDELING_ID,
> /* Solgt antal ATD*/
> (
> Select SUM(Varer_Omsetning.Antal) From
> Varer_Omsetning
> Where
>
> ((Varer_Omsetning.aar*100)+Varer_Omsetning.mdr)>=(:PFraPeriode) and
>
> ((Varer_Omsetning.aar*100)++Varer_Omsetning.mdr)<=(:PTIlPeriode) and
> (Varer_Omsetning.Afdeling_ID=Varer_detail.afdeling_ID) and
> (Varer_omsetning.vareplu_id=Varer.plu_nr)
>
> having
> SUM(Varer_Omsetning.Antal)>8 and (not
> (SUM(Varer_Omsetning.Antal) is null))
>
> ) As Antal
> FROM VARER_DETAIL
> INNER JOIN VARER ON (VARER_DETAIL.VAREPLU_ID = VARER.PLU_NR)
> GROUP BY
> VARER.PLU_NR,
> VARER_DETAIL.AFDELING_ID,
> VARER_DETAIL.ANTALSTK
> Order By VARER_detail.AntalStk Asc
>
>
> This (in my small DB) returns i.e.:
>
> 011439 -262 001 60
> 112352 -162 001 NULL
>
> Can I add something to the above SQL the make the line with the NULL
> value NOT being returned ?
>
> Regards
> Michael