title: Get last 3 rows in a SELECT statement and make it ASC order
body: <p>I have this mysql query that i want to query only last 3 rows of my SELECT statement, and I want to reorder again my query to ASC order as the subquery is in DESC.</p>
  
  <pre><code> SELECT * FROM( 
        SELECT * 
        FROM post_replies 
        WHERE post_replies.post_hash=:posthash 
        ORDER BY post_replies.reply_id DESC 
        LIMIT 3)
      ORDER BY reply_id ASC
  </code></pre>
  
  <p>This is the error that appears</p>
  
  <blockquote>
    <p>CDbCommand failed to execute the SQL statement: SQLSTATE[42000]:
    Syntax error or access violation: 1248 Every derived table must have
    its own alias. The SQL statement executed was: SELECT * FROM( SELECT *
    FROM post_replies WHERE post_replies.post_hash=:posthash ORDER BY
    post_replies.reply_id DESC LIMIT 3) ORDER BY reply_id ASC</p>
  </blockquote>
  
  <p>I don't understand on how i can put mysql Alias here as defined <a href="http://www.w3schools.com/sql/sql_alias.asp" rel="nofollow">here</a></p>
  
  <p>how can i make my query get only the last 3 rows of my select statement and make the results in ASC order?</p>