title: Writing a query to delete a node that has not pinged the server for 3 minutes
body: <p>After every 5 seconds a node pings the server. If the ping is successful, node's time-stamp gets updated into the server database.After every 3 minutes server checks if there is any time-stamp older than 3 minutes. If it founds any,it removes the node from it's database.</p>
  
  <p>Now the problem. I am unable to implement this query. For example I want it in a rather simple way like :</p>
  
  <pre><code>// Get the server time-stamp in milliseconds
  
  select LastPingedAt from JustPinged where LastPingedAt &gt; 3 Minutes"
  
  // If it finds any,delete each of them from the database.
  </code></pre>
  
  <hr>
  
  <pre><code>The logic :
  Let the server's time stamp at the point of checking be 'serverStamp'
  Let the node's time stamp (time in milliseconds when it last pinged) in the 
  database's table be 'nodeStamp'.
  
  If ( serverStamp - nodeStamp &gt; 3 minutes)
  // Delete those nodes
  If( severStamp - nodeStamp &lt; 3 minutes)
  // retain those nodes
  </code></pre>
  
  <p>I am unable to design a the query to implement further.</p>
  
  <p>At any point, <code>JustPinged</code> table looks like :</p>
  
  <pre><code>--------------------------|----------------------
  NodesThatJustPinged       |          LastPingedAt
  --------------------------|-----------------------
   xxx.xxx.xxx.xxx          |          1355406367402
  --------------------------|-----------------------
   yyy.yyy.yyy.yyy          |          1355406421277
  --------------------------|-----------------------
  </code></pre>
  
  <p>The time is in milliseconds as from <code>new GregorianCalendar().getTimeInMillis()</code>.</p>