title: MySQL Nested Query Select Statement
body: <p>I've got a table that helps me keep track of the delay times between my slaves and the master. My question is how can I craft a select statement that:<br>
  1. gives me the latest delay values, without repeating (or skipping) ip addresses<br>
  2. doesn't need to be updated if I add additional servers, or as servers become unresponsive</p>
  
  <p>The goal of this query is to show me what servers are available to do work, and give me a rough estimate as to how hard they are working. Servers that are not operational, shouldn't appear in the results. I'm running a script to evaluate the delay times as CLI every minute, so if I could limit the possible records returned to the last minute and a half, that should be good enough to tell me which servers were up the last time they were queried.</p>
  
  <p>Table looks like this (columns renamed to protect the innocent):</p>
  
  <pre><code>id INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,  
  ip VARCHAR( 20 ) NOT NULL ,  
  sent TIMESTAMP NOT NULL ,  
  delay DECIMAL ( 7,4 ) NOT NULL ,  
  status VARCHAR( 100 ) NOT NULL ,  
  execution_time` DECIMAL ( 7,4 )NOT NULL ,  
  deleted` TINYINT NOT NULL ,  
  </code></pre>
  
  <p>Any help would be appreciated.</p>