title: Android SQLite3 Anomaly with DISTINCT?
body: <p>This query does not return what I would expect. Why?</p>
  
  <p>The table:</p>
  
  <pre><code>create table t
  (
      comment varchar(10),
      id int
  );
  </code></pre>
  
  <p>The data:</p>
  
  <pre><code>insert into t values ('C1', 1);
  insert into t values ('C2', 2);
  insert into t values ('C3', 3);
  insert into t values ('C4', 4);
  insert into t values ('C5', 5);
  insert into t values ('C6', 6);
  insert into t values ('C7', 7);
  insert into t values ('C8', 8);
  insert into t values ('C9', 9);
  insert into t values ('C1', 10);
  </code></pre>
  
  <p>The query:</p>
  
  <pre><code>select distinct comment from t order by id desc limit 8;
  </code></pre>
  
  <p>The result:</p>
  
  <pre><code>C9
  C8
  C7
  C6
  C5
  C4
  C3
  C2
  </code></pre>
  
  <p>When I leave DISTINCT out, I get the last row, but I want to suppress duplicates.
  My workaround returns the correct result set:</p>
  
  <pre><code>select comment from t group by comment order by max(id) desc limit 8;
  </code></pre>
  
  <p>But I am curious if my query is not valid (T-SQL for example does not allow both a DISTINCT and ORDER BY in one query unless the ordered column is in the select list) ? </p>