I have the following query that performs a full-text search on two columns in two different tables for the same search query in the MySQL Innodb database;
SELECT Id, MATCH (tb1.comment, tb2.comment) AGAINST (+'search term' IN BOOLEAN MODE) AS Relevance FROM tbl1 LEFT JOIN tb2 ON tb1.Id = tb2.Id WHERE MATCH (tb1.comment, tb2.comment) AGAINST (+'search term' IN BOOLEAN MODE) HAVING Relevance > 0
If I only run MATCH on tb1.comment, it works fine and I return the relevant search terms, but I want to execute it for both columns.
However, since another table is optional with a LEFT JOIN, it does not return anything if there are no matching identifiers. Any ideas on how to overcome this problem?
source share