title: Transposing using variables in SQL
body: <p>How do i make this into wide transposed format?</p>
  
  <pre><code>  Id         Food   price      Date            
    1          K      200        2017-01-02
    2          L      150        2017-01-02
    3          M      110        2017-01-02
  </code></pre>
  
  <p>without using pivot and without hardcoding it?</p>
  
  <p>I'm not able to figure out how to not hardcode this. Hardcoding would be:</p>
  
  <pre><code>select Date,
  max(if(Food='K', 200, null)) as FoodA,
  max(if(Food='L', 150, null)) as FoodB,
  max(if(Food='M', 110, null)) as FoodC
  from table
  group by Date
  </code></pre>