MySQL check duplicate with group by using wildcard?
Your query can return the expected results by adding the reverse condition:

SELECT A.*, IF(B.ID IS NULL, "", "DUP") as DUP
FROM persons A 
LEFT JOIN persons B 
ON a.ID &lt;&gt; b.ID 
AND (a.Name LIKE CONCAT ("%", b.Name, "%") OR b.Name LIKE CONCAT ("%", a.Name, "%"))
ORDER BY ID;


I don't know if it will be faster, but another way to do it would be to use INSTR:

SELECT A.*, IF(B.ID IS NULL, "", "DUP") as DUP
FROM persons A 
LEFT JOIN persons B 
ON a.ID &lt;&gt; b.ID 
AND (Instr(a.Name, b.Name) &gt; 0 OR Instr(b.Name, a.Name) &gt; 0)
ORDER BY ID;


SQL Fiddle