Subject | LIKE statement and NULL field |
---|---|
Author | Tanz Anthrox |
Post date | 2004-02-18T07:18:19Z |
Hi,
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
All the parameters are % at the beginning and this SQL. Some of them are changing by user. And result must include NULLs
Regards.
[Non-text portions of this message have been removed]
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
All the parameters are % at the beginning and this SQL. Some of them are changing by user. And result must include NULLs
Regards.
[Non-text portions of this message have been removed]