title: Getting data from multiple rows using joins in phpMyAdmin
body: <p>On a chat app am making, A user can start a conversation with any other user.
  In order to have threaded sms view, a user clicks on one of these conversation listview to get all messages sent or received by the person they are chatting with.
  How do i modify the query to show the sender name if am the receiver and receiver name if am the sender?</p>
  
  <pre><code>Example table
  Id sender receiver
  1   1           2
  2   1           3
  3   4           1
  4   5           1
  5   8           6
  </code></pre>
  
  <p>QUERY </p>
  
  <pre><code>SELECT conversation.Id,
         conversation.Sender,
         conversation.Receiver,
         users.username as NAME
  FROM conversation
  INNER JOIN users
      ON conversation.Sender = users.id
  where sender = 1 OR receiver = 1
  </code></pre>
  
  <p>RESULT:</p>
  
  <pre><code>Id sender receiver NAME
  1   1           2            razen
  2   1           3            razen
  3   4           1            peter
  4   5           1            john
  </code></pre>
  
  <p>How do i modify the query to give me the name of the sender if am the receiver and the name of the receiver if am the sender?</p>
  
  <p>The listview should only show other peoples names not mine..
  (Show sam and kim for id 2&amp;3 in the table above)</p>