SQL dołącz do Wildcard
select *
from tableA a join
tableB b
on a.id like '%' + b.id + '%';
Combative Cat
select *
from tableA a join
tableB b
on a.id like '%' + b.id + '%';