0

I have the below code to match on similar characters where possible and it only brings through results from subquery A. Please can someone assist? Thanks

    select 
        * 
    from 
        (
            Select 'Test' T
        )a
        left join
        (
            Select 'Test1' T
        )b
    on
        '%' + a.t + '%' 
    like 
        '%' + b.t  + '%'
Krishn
  • 813
  • 3
  • 14
  • 28

1 Answers1

3

The like pattern only goes on the right side of the operator. I think you intend:

on (a.t like '%' + b.t + '%') or
   (b.t like '%' + a.t + '%')
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786