title: table structure for personal messages
body: <p>What is the best table structure to store dialogs between users in private messages?
  Each user can send personal message to many recepients.
  Each message has flag for sender: is message deleted or not
  Each message has flag for receiver: is message unread, read or deleted
  Each message can be deleted (set flag 'deleted')</p>
  
  <p>PrivateMessages' main page should look like this:</p>
  
  <p>E.g. User1 sends Message1 to User2 and User3.
  On private message page I have to show 2 same messages:</p>
  
  <ol>
  <li>sent Message1 to user2</li>
  <li>sent Message1 to user3</li>
  </ol>
  
  <p>next step - User2 replies to Message2, I'll see on the same page following:</p>
  
  <ol>
  <li>received Message2 from user2 (reply on Message1)</li>
  <li>sent Message1 to user3</li>
  </ol>
  
  <p>next step, I answer to message3, I'll see</p>
  
  <ol>
  <li>sent Message3 to user2</li>
  <li>sent Message1 to user3</li>
  </ol>
  
  <p>and so on. </p>
  
  <p>Can anyone provide a table-structure?
  I'm using MySQL 5.5</p>
  
  <p>Main question. How can I get only the last non-deleted message of each dialog?</p>
  
  <p><strong>UPD.</strong></p>
  
  <p>I need to see on main page dialog list, between current user and other users (with pagination, sorted by Date DESC). </p>