title: How to compare values with multiple values from another table in SQL using IN and LIKE operator?
body: <p>I have a list of values in one table:</p>
  
  <pre><code>GenericUserNames
  test
  temp
  trainee
  123
  </code></pre>
  
  <p>Those values need to be compared to the fields <code>UserID</code> and <code>UserName</code> in this table:</p>
  
  <pre><code>UserID, UserName
  test123, test 123
  GriffinPeter, Peter Griffin
  traineeone, trainee one
  </code></pre>
  
  <p>If one of them contains part of one of the values, the <code>EvalCheck</code> needs to be set to 1, otherwise to 0.</p>
  
  <pre><code>UserID, UserName, EvalCheck
  test123, test 123, 1
  GriffinPeter, Peter Griffin, 0
  traineeone, trainee one, 1
  </code></pre>
  
  <p>Here is what I have so far:</p>
  
  <pre><code>Select A.GenericUserNames
    B.UserID,
    B.UserName
    (Case
    When B.UserName Or B.UderID Like '%' + In (Select A.GenericUserNames From A) + '%'
    Else 0
    End
    ) As EvalCheck
  From  A, B
  </code></pre>
  
  <p>Please note, that I need to compare all columns for one user/line to all values of the generic user names.</p>