I have two tables which should store the same value in the mId and keyValue columns. But I run the following command and I got the following results:
mysql> select count(distinct mId) from Types;
+---------------------+
| count(distinct mId) |
+---------------------+
| 2098350 |
+---------------------+
select count(distinct keyValue) from EntityIndex;
+--------------------------+
| count(distinct keyValue) |
+--------------------------+
| 2095481 |
+--------------------------+
To find the mId which are just exist in Type table. I run the following commands and I got the following results:
mysql> select distinct mId from Types where not exists
(select distinct keyValue from EntityIndex);
Empty set (0.00 sec)
mysql> select distinct keyValue from EntityIndex where not exists
(select distinct mId from Types);
Empty set (0.01 sec)
what is the problem?
I think you can find the missing values this way
And you can try also not in