title: Join 3 tables of users, friends, chats
body: <p>I just want to get the result of a single user's friends and for each friend to join the last timestamp of the chat between the user and the friend:</p>
  
  <p>User friends list:</p>
  
  <ul>
  <li><p>Friend1: fname, lname,...., chat timestamp</p></li>
  <li><p>Friend2: fname, lname,...., chat timestamp</p></li>
  <li><p>...</p></li>
  </ul>
  
  <p><code>users</code> table is the main user information table:</p>
  
  <p>usr_id,usr_fname,usr_lname</p>
  
  <p><code>friends</code> table is a table containing the friendships:</p>
  
  <p>frd_id, frd_usr_id1, frd_usr_id2</p>
  
  <p><code>chats</code> table is a table containing chats between users:</p>
  
  <p>cht_id, cht_usr_id1,cht_usr_id2,cht_timestamp</p>
  
  <p><strong>Can anyone help me with SQL statements?</strong></p>
  
  <p><strong>Let say that the requesting user ID is in $user_id variable</strong></p>