title: LINQ orderby FK using a left join
body: <p>I have the following code:</p>
  
  <pre><code>from _categories in context.SCT_Categories
  join _categoryOrders in context.SCT_CategoryOrders
  on _categories.ID equals _categoryOrders.CategoryID into joinedData
  from _categoryOrders in joinedData.DefaultIfEmpty()
  orderby _categoryOrders.OrderIndex descending 
  select _categories
  </code></pre>
  
  <p>Which does a left join on categories and categoryOrders</p>
  
  <p>For every catgoryOrder there is a category.</p>
  
  <p>This works well, except that when I want to order by OrderIndex (Can be null to 999) it places all empty (i.e. null returned relationships where a category has no categoryOrder) at the top of the query.</p>
  
  <p>How do I change this to put empty values at the end of the list? Prefereably without an iteration after the query to change empty values to 999.</p>
  
  <p>Thanks,</p>
  
  <p>JD</p>