title: Another LINQ OrderBy query
body: <p>I have a table (as in a list of numbers) that gets recreated through a series of linq queries.  I'm trying to sort the columns in descending order based upon the values within the first row.</p>
  
  <p>My Database looks like this:</p>
  
  <pre><code>Data
  {
     ColumnLabel,
     RowLabel,
     Value
  }
  
  {"Cat", "All", 9}
  {"Dog","All", 17}
  {"Fish", "All", 4}
  
  {"Cat", "Girls", 3}
  {"Dog","Girls", 2}
  {"Fish", "Girls", 2}
  
  {"Cat", "Boys", 6}
  {"Dog","Boys", 15}
  {"Fish", "Boys", 2}
  </code></pre>
  
  <p>When I naively join this table together it looks like this:</p>
  
  <pre><code>      Cat | Dog | Fish
  All    9     17     4
  Girls  3     15     2
  Boys   6     2      2
  </code></pre>
  
  <p>What I want to do is sort the <code>ColumnLabels</code> in descending order based on <code>Value</code> where <code>RowLabel == "All"</code>.  The way I WANT the table to look is like this:</p>
  
  <pre><code>      Dog | Cat | Fish
  All    17    9     4
  Girls  15    3     2
  Boys   2     6     2
  </code></pre>
  
  <p>Notice the Dog and Cat row flipped.</p>
  
  <p>I'll need to out put this table using HTML so I iterate through by each row.</p>
  
  <p>I start by sorting the <code>ColumnLabels</code>:</p>
  
  <p>var top = data.Where(x => x.RowLabel == "All")
                 .OrderBy(x => x.Data)
                 .Select(x => x.ColumnLabel).SingleOrDefault();</p>
  
  <p>Now <code>top</code> contains the order I want the Columns to appear; <code>{Dog, Cat, Fish}</code>.  I don't really care how the Rows are sorted vertically.</p>
  
  <p>What I then want to do is group each row based upon it's <code>RowLabel</code> value:</p>
  
  <pre><code>var row = data.GroupBy(x =&gt; x.RowLabel)
            .OrderBy(y =&gt; ??????????????);
            //I want to OrderBy the values in top
            //How do I do this?
  </code></pre>
  
  <p>I then iterate through each row and create my HTML table.  This part is easy, but I don't know how to order subsequent rows based upon the top order. How do I do this in LINQ?</p>