Hi @nononame2021 ,
try this code:
select case when m.last_name is null then null
when m.last_name is not null then cast([recordID] as varchar(20))
end as [recordID],
b.first_name as [based_table.first_name] ,
b.last_name as [based_table.last_name],
m.first_name as [match_table.first_name],
m.last_name as [match_table.last_name]
from based_table b
join match_table m
on b.first_name like '%'+m.first_name+'%'
output:
Best regards
Niko