title: Performing a function on rows with matching IDs
body: <p>Here is my problem: I have a dataset like this.</p>
  
  <hr>
  
  <pre><code>  ID | Date          
  1123 | 01-JUL-2015
  1123 | 02-JUL-2015
  1155 | 01-JUL-2015
  1180 | 02-JUL-2015
  1190 | 01-JUL-2015
  1190 | 03-JUL-2015
  </code></pre>
  
  <hr>
  
  <p>The above pipe-deliminated dataset is two columns, I apologize for bad formatting.</p>
  
  <p>What I need to do is find the matching IDs in the first column, and subtract the dates of the of the two matching IDs to see the difference in date. I hope to have the dataset look like the below.</p>
  
  <hr>
  
  <pre><code>  ID | Days
  1123 | 1
  1155 | 0
  1180 | 0
  1190 | 3
  </code></pre>
  
  <hr>
  
  <p>Does anyone know any useful functions or solutions to solve this problem? I am using Oracle SQL.</p>