I'm trying to match words from a table to a string when only the exact word matches, I've only been able to get very loose match so far by using a LIKE statement and it matches most things but the issue is it also matches partial words which I'm trying to avoid.
There isn't always a leading or trailing space.
SQL Query
SELECT GROUP_CONCAT(`keys` SEPARATOR ',')
FROM `table_keys`
WHERE "We Have One Cardboard Train Wheel" LIKE CONCAT('%', `keys`, '%');
table_keys
| keys |
|-----------|
| Car |
| Wheel |
| Roof |
Two matchs are returned which is Car, Wheel which is technically correct but I only want it to match if the whole word is present.
Current Output
Car,Wheel
Wanted Output
Wheel