title: mysql if() with max()
body: <p>I have a table named <code>attproduct</code>:</p>
  
  <p>there are three columns <code>id, attribute, values</code>.</p>
  
  <p>I have <code>color</code> and <code>brand</code> for each <code>id</code> in <code>attribute</code> column and corresponding values in <code>value</code> column</p>
  
  <pre><code>SELECT id, MAX( IF( attribute =  'brand', value, NULL ) ) AS Brand,
         MAX( IF( attribute =  'color', value, NULL ) ) AS color
  FROM fy.attproduct
  GROUP BY id
  </code></pre>
  
  <p>When I run this query i get output as desired in <code>id, brand, color</code> as columns.</p>
  
  <p>I need to know what is role of max in my query, when i remove max, i get null values</p>