title: How to create query in sql to pivot data?
body: <p>I have two tables named <code>PRODUCT</code> and <code>DETAIL</code></p>
  
  <pre><code>TABLE: PRODUCT
  slno  product
  1          x    
  2          y
  3          z
  
  TABLE: DETAIL
  product    detail
  x          good
  y          bad
  z          worse
  x          bad
  </code></pre>
  
  <p>I need to get output as</p>
  
  <pre><code>TABLE
  X      Y       Z
  good   bad     worse
  bad
  </code></pre>