If I run SELECT * FROM table;
on one of my tables, I get 87709 rows.
If I instead run SELECT * FROM table WHERE isDeleted = 0 OR isDeleted = 1;
on the same table, I get 87686 rows.
isDeleted only has the values of 0 or 1, which I have confirmed with SELECT DISTINCT isDeleted FROM table;
Where have the 23 missing rows gone?
ANSWER:
Thx Roland Aaronson for pointing out that phpMyAdmins “count” is not as accurate as COUNT(*)
.
Did SELECT COUNT(*) FROM table;
and SELECT COUNT(*) FROM table WHERE isDeleted = 0 OR isDeleted = 1;
which gave the same amount of rows! *YAY*
3
Answers
run this query
SELECT * FROM table WHERE isDeleted ISNULL
, then you will rows with the null. If it has 23 rows, that’s where the problem liesTry:
If you want to get an accurate count and all the distinct values. I am guessing your “count” might be what something like phpMyAdmin is showing, which may not be accurate.
You could confirm the values is not null by