title: Messaging system MYSQL, issue with getting latest reply
body: <p>I have a table with</p>
  
  <p>message_id, to_id, from_id, message</p>
  
  <p>I made a threaded messaging system. I have 5 people talking to 1 member.</p>
  
  <p>As the member I see</p>
  
  <p>Member 1 says hi, member 2 says hello    ( I want this to say latest reply was hello )</p>
  
  <p>Member 1 says hi, member 3 says hi, member 1 says welcome ( I want this to say welcome )</p>
  
  <p>member 2 says hi (I want this to say hi )</p>
  
  <p>Now, I'm only provided with one of the ID's which is the sessionid of the member1. How would I go about showing scenario 2 where I (member1) have left the latest reply.</p>
  
  <p>I can easily do </p>
  
  <pre><code> SELECT * FROM messages WHERE to_id=$session_id ORDER BY message_id DESC LIMIT 1 
  </code></pre>
  
  <p>but that would only show the INCOMING messages. I need to show the LAST of the incoming AND outgoing messages.</p>
  
  <p>What query would you suggest? :\ Maybe an alteration to the table if there's no efficient way? First time i've ever setup a messaging system, advice is welcome.</p>