I am having a strange problem with a query... I have a table that
contains 3 columns and 3,315,599 rows.  One of the columns is a date
time field.  Out of 3,315,599 rows 1,555,157 contain an entry in the
date time field and the other 1,760,442 rows contain null in the date
time field.... Here is the problem I will illustrate it with queries and
results.



Illustrates the number of rows in the table

mysql> select count(compid) from dbLastFaxed ;
+---------------+
| count(compid) |
+---------------+
|       3315599 |
+---------------+
1 row in set (0.00 sec)



illustrates the number of rows with dates in the lastFaxedDateTime field

mysql> select count(compid) from dbLastFaxed where lastFaxedDateTime <
'2001-12-01 00:00' ;
+---------------+
| count(compid) |
+---------------+
|       1555157 |
+---------------+
1 row in set (7.84 sec)



illustrates the number of rows with a null value in the
lastFaxedDateTime field

mysql> select count(compid) from dbLastFaxed where lastFaxedDateTime =
null ;
+---------------+
| count(compid) |
+---------------+
|       1760442 |
+---------------+
1 row in set (11.05 sec)



Huh?  Shouldn't this query yield 3,315,599 (1,555,157+1,760,442)  Whats
going on here?

mysql> select count(compid) from dbLastFaxed where lastFaxedDateTime <
'2001-12-01 00:00' or lastFaxedDateTime =null;
+---------------+
| count(compid) |
+---------------+
|       1555157 |
+---------------+
1 row in set (8.29 sec)


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to