title: Sorting tree with other column in SQL Server 2008
body: <p>I have a table which implements a tree using <strong>hierarchyid</strong> column</p>
  
  <p>Sample data:</p>
  
  <pre><code>People             \
      Girls          \1\
          Zoey       \1\1\
          Kate       \1\2\
          Monica     \1\3\
      Boys           \2\
          Mark       \2\1\
          David      \2\2\
  </code></pre>
  
  <p>This is the order using <strong>hierarchyid</strong> column as sort column</p>
  
  <p>I would like to sort data using <strong>hierarchyid</strong> but also using <strong>name</strong> so it would look like this:</p>
  
  <pre><code>People             \
      Boys           \2\
          David      \2\2\
          Mark       \2\1\        
      Girls          \1\
          Kate       \1\2\
          Monica     \1\3\
          Zoey       \1\1\    
  </code></pre>
  
  <p>Is there a simple solution to do this?</p>
  
  <p>Can it be done with a single <code>SQL</code> query?</p>