title: Apply ORDER BY after query and LIMIT
body: <p>Have found similar posts but still stuck - I am trying to apply a sort AFTER I have processed a query and limited the results. My code is </p>
  
  <pre><code>select DISTINCT(t.id) t_id, t.cart_id ,tS.id tS_id, tS.created tS_created, t.value, t.transactionType_id tT_id, tS.member_name, outIn, tT.type type
  
                              from(transaction t)
                              join transactionSummary tS ON tS.id = t.transactionSummary_id
                              left join transactionType tT ON tT.id = t.transactionType_id
                              order by t.id DESC
                              limit 50
  </code></pre>
  
  <p>I have tried doing a sub select and applying the ORDER BY afterwards but get an error saying Unknown column 't.id' in 'field list'.</p>
  
  <p>The above code (ie without the sub select) works fine but the ORDER BY slows it down so much as the table is huge...
  Any suggestions?</p>