title: FIND_IN_SET in mysql
body: <p>I have a query that grabs info from a bunch of tables, including setting two columns to either 1 or 0 depending on the value of a field in another table; you can ignore the vast majority of it - I'm only concerned with the two IF lines:</p>
  
  <pre><code>SELECT DISTINCT CONCAT(np.first_name,' ',np.last_name) AS name, np.last_name, np.id, np.title, nc.web_name AS company, xsp.image_file AS image,
  
  IF(prx.people_role_id IN(7,8),1,0) AS rfac,
  IF(prx.people_role_id = 8,1,0) AS dfac
  
  FROM expo_speaker xsp
  
  LEFT JOIN expo_session_speaker xssx ON xssx.speaker_id = xsp.speaker_id
  LEFT JOIN expo_session xss ON xss.session_id = xssx.session_id
  LEFT JOIN new_people np ON np.id = xsp.people_id
  LEFT JOIN people_role_xref prx ON prx.people_id = np.id
  LEFT JOIN new_company nc ON np.company_id = nc.id
  
  WHERE np.active = 1
  AND xss.session_id = $sym-&gt;id
  GROUP BY np.title
  ORDER BY np.last_name
  </code></pre>
  
  <p>This worked just fine when each person could only have one role (represented by prx.people_role_id). However, requirements changed recently, and each user can now have anywhere from zero to twelve different roles (and that number can change at any time.)</p>
  
  <p>I've looked into find_in_set, but can't figure out how to combine it with the IN clause. I've tried group_concat(prx.people_role_id) , which gives me a comma-delimited list of all the roles assigned to a user. If there were only one role that we were looking for, it would be easy to use find_in_set to see if that role existed in the list of assigned roles. But we have two possible roles for one of the IF statements. How can I combine these functions (or any other) to determine if the group_concat column contains either 7 or 8?</p>