title: Linq Query Returns Duplcates After Left Outer Join
body: <p>I have table1 and table2 both have unique records and I need to left outer join to get DESCR from table2.</p>
  <p><strong>table1:</strong></p>
  <pre><code>ID
  SUBJECT
  CATALOG_NBR
  ...
  </code></pre>
  <p><strong>table2:</strong></p>
  <pre><code>SUBJECT
  CATALOG_NBR
  DESCR
  ...
  </code></pre>
  <p>However after left outer join, I get double records. I tried groupby and still returns duplicates. Below is my query:</p>
  <pre class="lang-cs prettyprint-override"><code>IQueryable&lt;joinedTable&gt; qry = (from a in db.table1
      join b in db.table2 on 
          new { SUBJECT=a.SUBJECT, CATALOG_NBR=a.CATALOG_NBR } equals
          new { SUBJECT = b.SUBJECT, CATALOG_NBR = b.CATALOG_NBR } 
      into ab from x  in ab.DefaultIfEmpty()
      select new joinedTable()
      {
          ID=a.ID,
          SUBJECT=a.SUBJECT,
          CATALOG_NBR=a.CATALOG_NBR,
          DESCR=x.DESCR
      }
      .GroupBy(a=&gt;a.ID)
      .Select(a=&gt;a.FirstOrDefault())
      .AsQueryable();
  </code></pre>
  <p>What is the problem in my query? Thanks.</p>