title: SQL Pivot for multiple values
body: <p>Here is the data that i have </p>
  
  <pre><code>   Product_ID      Question      Answer
        1             When          Monday
        1             Where         Home
        1             Where         Work
        1              How          Car
        2             When          saturday
        2             Where         Home
        2             Where         Church
        2              How           Bus
        2              How           Walk
  </code></pre>
  
  <p>I would like the data to presented as below </p>
  
  <pre><code>  Product_ID        When         Where   How
        1             Monday       Home    Car
        1             Monday       Work    Car
        2             Saturday     Home    Bus
        2             Saturday     Church  Bus
        2             Saturday     Home    Walk
        2             Saturday     Church  Walk
  </code></pre>
  
  <p>But I was only able to pivot the data and was able to get in the below style</p>
  
  <pre><code>  Product_ID        When         Where
        1             Monday       Work
        2             Saturday     Home
  </code></pre>
  
  <p>using the below query </p>
  
  <pre><code> select * from 
  (
  select product_ID,question,answer from table1
  ) src
  pivot (
  max(answer)
  for question in ([when],[where])
  )piv
  </code></pre>