SQL Присоединяйтесь к подстановочному знаку

select *
from tableA a join
     tableB b
     on a.id like '%' + b.id + '%';
Combative Cat