Není dobrý nápad uchovávat data tímto způsobem.
První nápad, který mě napadl, je:http://sqlfiddle.com/#!2/ 1dd77/4
SELECT b.*, GROUP_CONCAT(a.name SEPARATOR ':')
FROM table2 as b
LEFT JOIN table1 as a
on b.var = a.id
OR b.var regexp(CONCAT('^',a.id,':'))
OR b.var regexp(CONCAT(':',a.id,':'))
OR b.var regexp(CONCAT(':',a.id,'$'))
GROUP BY b.id
UPRAVIT 1
Objednaná varianta:http://sqlfiddle.com/#!2/1dd77/38
SELECT b.*, GROUP_CONCAT(a.name ORDER BY FIND_IN_SET(a.id, REPLACE(b.var,":",",")) SEPARATOR ':' )
FROM table2 as b
LEFT JOIN table1 as a
on b.var = a.id
OR b.var regexp(CONCAT('^',a.id,':'))
OR b.var regexp(CONCAT(':',a.id,':'))
OR b.var regexp(CONCAT(':',a.id,'$'))
GROUP BY b.id