title: Is there any MySQL Aggregate Function for "CONTAINS"?
body: <p>Say I have this data set</p>
  
  <pre>
    user  | group
  --------+-------
  a@a.com |   A
  a@a.com |   B
  b@b.com |   A
  c@c.com |   B
  d@d.com |   A
  d@d.com |   B
  d@d.com |   C
  </pre>
  
  <p>I want to convert this into a table like this:</p>
  
  <pre>
    user  | IN_A  | IN_B  | IN_C
  --------+-------+-------+-------
  a@a.com | TRUE  | TRUE  | FALSE
  b@b.com | TRUE  | FALSE | FALSE
  c@c.com | FALSE | TRUE  | FALSE
  d@d.com | TRUE  | TRUE  | TRUE
  </pre>
  
  <p>I've got:</p>
  
  <pre>
  SELECT
    user,
    IF(LOCATE('A', GROUP_CONCAT(group)) > 0, TRUE, FALSE) AS IN_A,
    IF(LOCATE('B', GROUP_CONCAT(group)) > 0, TRUE, FALSE) AS IN_B,
    IF(LOCATE('C', GROUP_CONCAT(group)) > 0, TRUE, FALSE) AS IN_C
  FROM users
  GROUP BY user
  </pre>
  
  <p>What I'm wondering is if there is a better way to known if an aggregated field contains a value, or if this is the only way?</p>