title: SQL Question: Getting Datediff in days elapsed for each record in a group
body: <p>Given this table:</p>
  
  <p><img src="https://imgur.com/qt1k7.jpg" alt="alt text"></p>
  
  <p>How can I get the datediff in days between each status_date for each group of ID_Number?  In other words I need to find the number of elapsed days for each status that the ID_Number has been given.</p>
  
  <p>Some things to know:</p>
  
  <ul>
  <li>All ID_Number will have a received_date which should be the earliest date for each ID_Number (but app doesn't enforce)</li>
  <li>For each ID_Number there will be a status with a corresponding status_date which is the date that the ID_Number was given that particular status.</li>
  <li>The status column doesn't always necessarily go in the same order every time (app doesn't enforce)</li>
  <li>All ID_Number will have a closed_date which should be the latest date (but app doesn't enforce)</li>
  </ul>
  
  <p>Sample output:
  So for ID_Number 2001, the first date (received_date) is 2009-05-02 and the next date you encounter has a status of 'open' and is 2009-05-02 so elapsed days is 0.  Moving on to the next date encountered is 2009-05-10 with a status of 'invest' and the elapsed days is 8 counting from the prior date.  The next date encountered is 2009-07-11 and the elapsed days is 62 counting from the previous date. </p>
  
  <p><strong>Edited to add:</strong></p>
  
  <p>Is it possible to have the elapsed days end up as a column on this table/view?
  I also forgot to add that this is SQL Server 2000.</p>