I have the following query:
SELECT apps.Field4,
ISNULL(apps.field4, '-1')
FROM applications apps
WHERE apps.OBJECT_ID = 1727847
AND ISNULL(apps.Field4, -1) = -1
apps.field4is an integer, and no record has a value less than 0 for field4.
Return values for the above query:
+------+----+
| NULL | -1 |
+------+----+
But if I add AND apps.field4 is NULLa where clause, the entries are not returned:
SELECT apps.Field4,
ISNULL(apps.field4, '-1')
FROM applications apps
WHERE apps.OBJECT_ID = 1727847
AND apps.field4 IS NULL
AND ISNULL(apps.Field4, -1) = -1
Why ISNULLdoes it seem to correctly identify the value NULL, but IS NULLdoes not work?
source
share