title: Mysql: help in query from two tables
body: <p>I have two tables: users,friends thus structured:  </p>
  
  <p>Users:  </p>
  
  <pre><code>+------------+--------------+.  
  | users_id   | username     |.  
  +------------+--------------+.  
  | 1          | Mark         |.  
  | 2          | Alex         |.  
  | 3          | Anna         |.  
  +------------+--------------+.  
  </code></pre>
  
  <p>Friends:  </p>
  
  <pre><code>+------------+--------------+.  
  | id |fromid |  toid        |.  
  +------------+--------------+.  
  | 1  |    2  |     3        |.  
  | 2  |    1  |     2        |.  
  | 3  |    1  |     3        |.  
  +------------+--------------+.   
  </code></pre>
  
  <p>What's the query to retrieve these results:   </p>
  
  <pre><code>+------------+--------------+.  
  | from       |     to       |    
  +------------+--------------+.  
  | Alex       | Anna         |    
  | Mark       | Alex         |.  
  | Mark       | Anna         |.  
  +------------+--------------+.        
  </code></pre>
  
  <p>P.s.: excuse me if tables are not properly formatted in my question</p>