(select mods.*, games.id 'gameid', games.name as 'gamename' from mods inner join `games` ON mods.supports=games.id where (concat_ws(' ',mods.name,games.name) REGEXP '[[:<:]]'""[[:>:]]')) UNION DISTINCT (select mods.*, games.id 'gameid', games.name as 'gamename' from mods inner join `games` ON mods.supports=games.id where (concat_ws(' ',mods.name,games.name) REGEXP '[[:<:]]'""[[:>:]]'))