title: Check for new messages with SQL [facebook like chat]
body: <p>I'm currently developing a facebook like chat for my website. Right now I am asking myself, <strong>what is the best way (the best sql query) to check for new messages?</strong>
  My tables look like this:</p>
  
  <p><strong>messages</strong></p>
  
  <pre><code>messageID   | userID    | roomID    | message   | time
  -----------------------------------------------------------
   4          | 1         | 1         | test      | 1369062603 
   9          | 2         | 1         | great     | 1369062609
  </code></pre>
  
  <p><strong>rooms</strong> </p>
  
  <pre><code>roomID  | host  | createTime
  -----------------------------
   1      | 1     | 1369062600
  </code></pre>
  
  <p><strong>room_to_user</strong></p>
  
  <pre><code>roomID  | userID 
  ----------------
   1      | 1     
   1      | 2     
  </code></pre>
  
  <p>I plan to add group chatting that's why I don't want to add a sepereate <strong>read</strong> column to my message table.
  My next attempt would be a sql query filtered by the time <strong>column</strong>.</p>
  
  <p>What would be your attempt? Thanks!</p>