title: Why is Select distinct from function returning duplicates?
body: <p>I tried two different variations on the same thing.  The first version selects from <code>freetexttable</code>, the other insets into a temp table and selects from that.  I've tried numerous variations on the first version (select several combinations, at both levels of scope, of group by, distinct, and casting [rank] to an integer.  Regardless, the first query consistently returns 3 rows each having value <code>137</code> whereas the second query consistently returns 1 row having value of <code>137</code>.</p>
  
  <p>What is going on here? Why does freetext return duplicates and why aren't they eliminated with <code>select distinct</code> or with <code>group by</code>?</p>
  
  <p><b>Note: I want to know why, not how to fix it.</b>  I already have acceptable workarounds.</p>
  
  <pre><code>select * from
  (
  select distinct [rank] from freetexttable(dbo.vw_PPN, allKeywords, N'foo', 100000 )
  where [key] = 3781054
  ) as CT
  
  create table #temp ([rank] int)
  insert into #temp
      select distinct [rank] from freetexttable(dbo.vw_PPN, allKeywords, N'foo', 100000 )
      where [key] = 3781054
  select * from #temp
  drop table #temp
  </code></pre>