title: Mysql with Group by + IF + Left Join + Group_Concat
body: <p>I'm think its so trivial, but I stuck with this:</p>
  
  <pre><code>SELECT u.id, u.name,
  
  IF(s.prod_id=0, 1,NULL) as amount,
  IF(s.prod_id=92, 2,NULL) as amount2,
  IF(s.prod_id=116, 3,NULL) as amount3,
  IF(s.prod_id=134, 4,NULL) as amount4
  
  FROM table_user u
  
  LEFT JOIN table_user_status s ON s.user_id = u.id 
  where s.prod_id = 0 OR s.prod_id = 92 OR s.prod_id = 117 OR s.prod_id = 134
  
  -- GROUP BY u.id
  order by u.id ASC 
  </code></pre>
  
  <p>I get something like:</p>
  
  <pre><code>22 | Matt | 1|NULL|NULL|NULL
  
  22 | Matt | NULL|2|NULL|NULL
  </code></pre>
  
  <p>After Group by id I get <code>22 MATT 1 NULL NULL NULL</code> and then next record.</p>
  
  <p>At the end i must user group_concat for data like
  <code>22 | Matt | 1,2 |</code></p>
  
  <p>Thanks!</p>