title: SQL Server Pivots: Displaying row values to column headers
body: <p>I have a table (items) which is in the following format:</p>
  
  <pre><code>ITEMNO | WEEKNO | VALUE  
  A1234  |   1    |  805  
  A2345  |   2    |  14.50  
  A3547  |   2    |  1396.70  
  A2208  |   1    |  17.65  
  A4326  |   6    |  19.99
  </code></pre>
  
  <p>It's a table which shows the value of sales for items in a given week.</p>
  
  <p>The results or what I want to display in a table format is the item number in a row followed by columns for each week containing the values, e.g.</p>
  
  <pre><code>ITEMNO | WK1 | WK2 | WK3 | WK4 | WK5  ...etc up to 52  
  A1234  | 805 | 345 | 234 | 12  | 10   ...etc up to 52  
  A2345  |  23 | 12  | 456 | 34  | 99   ...etc up to 52  
  A3456  | 234 | 123 | 34  | 25  | 190  ...etc up to 52  
  </code></pre>
  
  <p>Although I've 52...so I've only data for up to week9 but that will increase with time.</p>
  
  <p>So basically what it is I'm looking to display is the week number value as a column header.</p>
  
  <p>Is this possible...although I'm tempted to just grab the data and display properly through code/(asp.net) but I was wondering if there was away to display it like this in SQL?</p>
  
  <p>Does anyone know or think that that this might be the best way?</p>