SELECT *
FROM Posts
WHERE MATCH (Posts.City) AGAINST ('Lujan')
Shows 29 rows. But:
SELECT Users.*, Posts.*
FROM Users
INNER JOIN Posts ON Users.User = Posts.User
WHERE MATCH (Posts.City) AGAINST ('Lujan')
Got me zero results, while I should get exactly the same results.
Adding explain to the query echoed:
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE Posts fulltext city_comparator,user_comparator city_comparator 0 1 Using where
1 SIMPLE Users eq_ref user_unique,user_comparator user_unique 62 chusmix.Posts.User 1
I have no idea what it means, but also in table users the fulltext index “user_comparator” had a cardinality of 0. While I have registered 10+ users. I also have a Unique index for column Users.User and a primary index for Users.ID.
I changed something and all queries with INNER JOIN stopped working. What can I do to fix this? thanks
It means that there is no row in the Users table which match with the Posts table. If you want to select the rows even if there is no match, use an external join (change the INNER JOIN with a RIGHT JOIN in your case).