title: IQueryable with distinct records and ordered
body: <p>I've been trying to get an <code>IQueryable</code> with distinct and ordered values, but I've found that I can't apply a distinct after <code>orderby</code> or I'll lose the order.</p>
  
  <p>The last query I tried was the following:</p>
  
  <pre><code>IQueryable&lt;gbd_Pages&gt; Listpagespages = 
        (from c in _db.gbd_Content
         where c.IsActive == true &amp;&amp; c.IsDeleted == false &amp;&amp; 
               c.gbd_Template_Fields.SortOrder == sortOrder
         orderby c.Content ascending
         select c.gbd_Pages);
  </code></pre>
  
  <p>With this I get repeated results.</p>
  
  <p>The table I want returned is <code>gbd_Pages</code> which has a relation of 1 to many with <code>gbd_Content</code>.
  With this i mean that <code>gbd_Content</code> will have a foreign key that will have the primary key of <code>gbd_Pages</code>.</p>
  
  <p>I need to do a sortOrder by the table gbd_Template_Fields wich has a relation 1 to 1 with <code>gbd_Content</code>.</p>
  
  <p>Is there a way for me to do this? I need it to be an <code>IQueryable</code> without converting to <code>IEnumerable</code> or list.</p>