title: How to mix ASC and RANDOM() on SQLite ORDER BY
body: <p>So, I'm facing an error while trying to use ORDER BY for 2 columns:</p>
  
  <p>...
  ORDER BY val, random();</p>
  
  <p>Error is: "2nd ORDER BY term does not match any column in the result set"</p>
  
  <p>I tried different ways to combine ASC sorting for 1st column and random sorting for second column, no luck.</p>
  
  <p>UPDATED to provide more info</p>
  
  <p>CREATE TABLE <code>tabela</code> (
      <code>id</code>    INTEGER,
      <code>val</code>   TEXT,
      PRIMARY KEY(<code>id</code>)
  );</p>
  
  <pre><code>INSERT INTO tabela (val) VALUES ('paid');
  INSERT INTO tabela (val) VALUES ('paid');
  INSERT INTO tabela (val) VALUES ('paid');
  INSERT INTO tabela (val) VALUES ('standard');
  INSERT INTO tabela (val) VALUES ('standard');
  INSERT INTO tabela (val) VALUES ('standard');
  INSERT INTO tabela (val) VALUES ('standard');
  INSERT INTO tabela (val) VALUES ('standard');
  </code></pre>
  
  <p>Expected sample result:</p>
  
  <pre><code>val        id
  ---        ---
  paid       3
  paid       1
  paid       2
  standard   5
  standard   8
  standard   4
  standard   6
  standard   7
  </code></pre>
  
  <p>where 'id' 1,2,3 will be randomly sorted within 'paid' 'val' and 'id' 4 ... 8 will be randomly sorted within 'standard' 'val'</p>