title: How to GROUP BY in SQL and then mark as 0,1
body: <p>I need to <code>GROUP BY item_id</code> and check if <code>user_id</code> in any of those matches a variable. If so, I want it to = 1, if not 0.</p>
  
  <p>for example, imagine table like this:</p>
  
  <pre><code>item_id, user_id
  1         1
  1         3
  2         4
  2         1
  2         7
  2         3
  3         4
  3         6
  4         8
  4         1
  5         3
  
  
  IF (user_id = 3,1,0) AS match,
  </code></pre>
  
  <p>Want my Query to come back as</p>
  
  <pre><code>item_id, match
  1        1 
  2        1
  3        0
  4        0
  5        1
  </code></pre>
  
  <p>Where "1" all occurrences of user_id 3 in an item_id group.</p>