LIKE and NOT LIKE can't retrieve NULL values, because a NULL record is neither LIKE nor NOT LIKE anything - it's just NULL.
NULLs are a bit strange to get your head around, but it does make sense once you understand them. NULL is not the same as zero or blank; NULL means "unknown or unquantifiable value". NULL isn't equal to or like anything; in fact, NULL is not even equal to NULL!
With your query, when the database gets to a record with a NULL value in the finished field, it can't say that NULL is like 'yes' (because it doesn't know what NULL is exactly; it's an unknown value), and in the next query it can't say that NULL is not like 'yes' (again because it doesn't know what NULL is exactly; it's an unknown value).
The only way to test for NULLS is by using "IS NULL" or "IS NOT NULL". If you ran the query:
SELECT count(*) FROM cases WHERE username like "karops" and completed>="2001-01-01" and completed<="2001-12-31" and finished IS NULL
you'd probably find your missing 14 records. If you wanted to combine them in the "not like" query, you could write it as:
SELECT count(*) FROM cases WHERE username like "karops" and completed>="2001-01-01" and completed<="2001-12-31" and (finished NOT LIKE 'yes' OR finished IS NULL)
which should get you your 52 records.
(Note that you say there are "some records with '' that you can find" - I imagine these will have blank entries rather than NULL values, which means the NOT LIKE expression will pick them up as it can compare blank to 'yes').
Hope that helps, I don't know if I explained NULLs very well. If you need to read more to understand it, try www.mysql.com - there ought to be a decent explanation of NULLs there.
Bookmarks