title: Select records all within 10 minutes from each other
body: <p>I have some data coming from a source in my Oracle database. </p>
  
  <p>If a particular Office_ID has been deactivated and it has all three clients (A,B,C) for a particular day, then we have to check whether all clients have gone. If yes, then we need to check whether timeframe for all clients is within 10 Minutes.</p>
  
  <p>If this repeats three times in a day for a particular office we declare the office as closed.</p>
  
  <p>Here is some sample data:</p>
  
  <pre><code>+-----------+-----------+--------------+--------+
  | OFFICE_ID | FAIL_TIME | ACTIVITY_DAY | CLIENT |
  | 1002      | 5:39:00   | 23/01/2015   | A      |
  | 1002      | 17:49:00  | 23/12/2014   | A      |
  | 1002      | 18:41:57  | 1/5/2014     | B      |
  | 1002      | 10:32:00  | 1/7/2014     | A      |
  | 1002      | 10:34:23  | 1/7/2014     | B      |
  | 1002      | 10:35:03  | 1/7/2014     | C      |
  | 1002      | 12:08:52  | 1/7/2014     | B      |
  | 1002      | 12:09:00  | 1/7/2014     | A      |
  | 1002      | 12:26:10  | 1/7/2014     | B      |
  | 1002      | 13:31:32  | 1/7/2014     | B      |
  | 1002      | 15:24:06  | 1/7/2014     | B      |
  | 1002      | 15:55:06  | 1/7/2014     | C      |
  +-----------+-----------+--------------+--------+
  </code></pre>
  
  <p>The result should be like this:</p>
  
  <pre><code>1002    10:32:00      A
  1002    10:34:23      B
  1002    10:35:03      C
  </code></pre>
  
  <p>Any help would be appreciated. I am looking for a  SQL query or a PL/SQL procedure.</p>