title: How do I get Linq to return identical repeated rows only once?
body: <p>I'm still pretty new to this, so go easy on me. I'm trying to get linq to return a single record when the query returns multiple identical records. Here's what I have:</p>
  
  <pre><code>var query = (from i in _db.BizListView
              let dist = DbGeography.FromText(i.Point).Distance(DbGeography.FromText(geog)) * .0006214
              where
                  dist &lt;= rng &amp;&amp;
                  i.Name.Contains(key) &amp;&amp;
                  pri != -1 ? (i.BizCategoryID == pri &amp;&amp; i.Primary == true) : true &amp;&amp;
                  biz != -1 ? (i.BizCategoryID == biz) : true  
              group i by new
              {
                  ClientID = i.ClientID,
                  Name = i.Name,
                  Address = i.Address,
                  Address1 = i.City + ", " + i.StateID + " " + i.PostCode,
                  BizPhone = i.BizPhone,
                  EmailAddress = i.EmailAddress,
                  ClientImagePath = i.ClientImagePath,
                  Distance = DbGeography.FromText(i.Point).Distance(DbGeography.FromText(geog)) * 0.0006214
              }
              into myTable                                                  
              orderby myTable.Key.Distance ascending
              select new 
              {
                  ClientID = myTable.Key.ClientID,
                  Name = myTable.Key.Name,
                  Address = myTable.Key.Address,
                  Address1 = myTable.Key.Address1,
                  BizPhone = myTable.Key.BizPhone,
                  EmailAddress = myTable.Key.EmailAddress,
                  ClientImagePath = myTable.Key.ClientImagePath,
                  Distance = myTable.Key.Distance                            
              }).Distinct();
  
  return query;
  </code></pre>
  
  <p>The query produces a single record for each client, as long as a BizCategory is specified, but returns multiple identical records per client (a record for each of the Client's BizCategories) if no BizCategory is specified. How can I get the query to return a single record per client, instead of multiple identical records when no BizCategory is specified?</p>