SELECT a.c1, a.ids, GROUP_CONCAT(b.name SEPARATOR '|') FROM Table1 a INNER JOIN Table2 b ON FIND_IN_SET(b.id, REPLACE(a.ids, '|', ',')) GROUP BY a.c1, a.ids