This question isn't relevant to MySQL. DIFFERENCE used like this is a SQL Server feature.
And in SQL Server, you are supposed to give *TWO* arguments to the DIFFERENCE function. In other words, you are indeed asking for how different two different strings are.
So that query, as given, makes no sense at all.
I can't even figure out what you think it is trying to do.
It would have made more sense to do something like:
But I'm not at all sure that is what you are trying to accomplish.
SELECT T1.company_name AS name1,
T1.company_name AS name2,
DIFFERENCE(T1.company_name, T2.company_name) AS theDifference
FROM table1 AS T1, table2 AS T2
WHERE DIFFERENCE(T1.company_name, T2.company_name) < 4
MODERATOR: Please move this to the "Other databases" section.