title: SQL query for returning row values as columns - SQL Server 2008
body: <p>I'm having trouble figuring out how to return a query result where I have row values that I want to turn into columns.</p>
  
  <p>In short, here is an example of my current schema in SQL Server 2008:  </p>
  
  <blockquote>
    <p><img src="https://i.stack.imgur.com/5amSe.png" alt="enter image description here"></p>
  </blockquote>
  
  <p>And here is an example of what I would like the query result to look like: </p>
  
  <blockquote>
    <p><img src="https://i.stack.imgur.com/sVE35.png" alt="enter image description here"></p>
  </blockquote>
  
  <p>Here is the SQLFiddle.com to play with - <a href="http://sqlfiddle.com/#!6/6b394/1/0" rel="nofollow noreferrer">http://sqlfiddle.com/#!6/6b394/1/0</a></p>
  
  <p>Some helpful notes about the schema:</p>
  
  <ul>
  <li>The table will always contain two rows for each day</li>
  <li>One row for Apples, and one row for Oranges</li>
  <li>I am trying to combine each pair of two rows into one row</li>
  <li>To do that I need to convert the row values into their own columns, but only the values for [NumOffered], [NumTaken], [NumAbandoned], [NumSpoiled] - NOT every column for each of these two rows needs to be duplicated, as you can see from the example</li>
  </ul>
  
  <p>As you can see, from the example desired end result image, the two rows are combined, and you can see each value has its own column with a relevant name.</p>
  
  <p>I've seen several examples of how this is possible, but not quite applicable for my purposes. I've seen examples using Grouping and Case methods. I've seen many uses of PIVOT, and even some custom function creation in SQL. I'm not sure which is the best approach for me. Can I get some insight on this?</p>