Subject | Re: [firebird-support] LIKE statement and NULL field |
---|---|
Author | Rolf & Sibylle Nussbaumer |
Post date | 2004-02-18T07:40:51Z |
Tanz Anthrox wrote:
try this
FROM MUHASEBE M
JOIN HAREKETKODLARI H
ON M.MUH_HAREKETKODU = H.HAREKETKODU
WHERE
(MUH_KAYITNO LIKE :KAYITNO OR :kayitno is null)
AND
etc. etc.
HTH
Rolf Nussbaumer
> Hi,Hi Tanz
>
> LIKE condition returns NOT NULL fields.
>
> A Simplified Ex:
>
> SELECT COUNT(*) FROM MUHASEBE
>
> Returns 145.000
>
>
> SELECT COUNT(*) FROM MUHASEBE
> WHERE MUH_ACIKLAMA LIKE '%'
>
> Returns 138.002
>
> Because some MUH_ACIKLAMA has NULL fields.
>
> QUESTION :
>
> What can I use for this situation? I need that Null fields also.
>
> EXACT SQL:
>
> SELECT
> M.MUH_KAYITNO,
> M.MUH_TARIH,
> M.MUH_MAKBUZNO,
> M.MUH_ACIKLAMA,
> H.HAREKETKODU_TIPI
>
> FROM MUHASEBE M
> JOIN HAREKETKODLARI H
> ON M.MUH_HAREKETKODU = H.HAREKETKODU
> WHERE
> (MUH_KAYITNO LIKE :KAYITNO)
> AND
> (MUH_TARIH LIKE :TARIH)
> AND
> (MUH_MAKBUZNO LIKE :EVRAKNO)
> AND
> (MUH_ACIKLAMA LIKE :ACIKLAMA)
> ORDER BY MUH_KAYITNO
>
try this
FROM MUHASEBE M
JOIN HAREKETKODLARI H
ON M.MUH_HAREKETKODU = H.HAREKETKODU
WHERE
(MUH_KAYITNO LIKE :KAYITNO OR :kayitno is null)
AND
etc. etc.
HTH
Rolf Nussbaumer