Subject Re: [firebird-support] Subquery and returning "0"
Author Łukasz Bączek
W dniu 12.07.2014 16:01, Mark Rotteveel mark@... [firebird-support] pisze:
 

On 12-7-2014 15:57, Łukasz Bączek baczeklu@... [firebird-support] wrote:
> Hello,
> I have a SQL query:
>
>
> SELECT
> CASE WHEN umowy.numer_umowy IS NULL THEN 0 END AS numer_umowy
> FROM umowy
> WHERE umowy.data_podpisania IS NOT NULL AND umowy.id_wnioski IN
> (SELECT CASE WHEN wnioski.id_wnioski IS NULL THEN 0 END AS id_wnioski
> FROM wnioski
> LEFT JOIN kategorie_wnioskow ON
> kategorie_wnioskow.id_kategorie_wnioskow=wnioski.id_kategorie_wnioskow
> WHERE kategorie_wnioskow.id_kategorie_wnioskow_typ=1) AND umowy.rok=2014
>
> How do I stop if "NUMER_UMOWY" is NULL is returned to "0" and not null

I have read this question multiple times, but I don't understand what
you mean. Could you give an example of data and the result you want to have?

After this query I have the result:

"UMOWY.NUMER_UMOWY" = NULL

It needs to

"UMOWY.NUMER_UMOWY" = 0