title: How to use column value as column header?
body: <p>I have a table like this:</p>
  
  <pre><code>ItemID    PartID   PartName   PartValue
    1         1        N1         v1
    1         2        N2         v2
    1         3        N3         v3
  ...
    2         1        N1          u1
    2         2        N2          u2
    2         3        N3          u3
  ...
  </code></pre>
  
  <p>Can I use a sql select statement to get following table?</p>
  
  <pre><code>ItemID    N1    N2    N3 ...
    1       v1    v2    v3 ...
    2       u1    u2    u3 ...
   ...
  </code></pre>
  
  <p>The problem is I don't know how many part names are there, so there might be also n4, n5, n6 ...so need dynamically select. I see some pivot examples but looks like it can be used when I know how many part names. If I don't know, how should I deal with this? Thanks!</p>