RE: Select Statement Q!!!
Posted in 1998
It is the way it is meant to work. You need to read up on the behaviour of nulls.
Take your pick from the Informix manuals, any explanation of ANSI SQL, or any
of C J Date's books on the subject.
Basically, if a column Fld1 contains a null, then neither the comparison Fld1 = 'A'
nor the comparison Fld1 != 'A' evaluates to true; both evaluate to unknown and are
ignored by the WHERE clause, so the COUNT never gets to count them.
Yours,
Jonathan Leffler (jleffler@visa.com) #include <bother.ms-exchange.h>
----------
From: Pinto, Raymond[SMTP:PINTOR@valuerx.com]
Sent: Tuesday, March 03, 1998 3:18 PM
Q. I have a query
select count(*) from table_a
where fld1 != 'A'
I get a count = 7000
fld1 is char(1)
There are 100000 records with fld1 = null
This query does not count the null values
From what I can see , Informix does not count the null values. Is this a
bug or is this the way it is supposed to work
Thanks in advance
Raymond Pinto
pinto@valuerx.com