title: Read next record?
body: <p>We are on MS SQL-Server 2012.Users want to know if the time of the patients next admission date is less than 30 days for any reason.  Doesn’t have to be seen by same provider       </p>
  
  <p>I am not sure how to read the next record, if the MRN ID is the same, then calculate the difference in days between the record you are on and the next next record.  </p>
  
  <p><strong>For example:</strong>  </p>
  
  <pre><code>Record 1 : MRNID =33 Discharge date = 1/1/2016  
  Record 2 : MRNID = 33 Admission date = 2/2/2016  
  </code></pre>
  
  <p>MRNIDs are the same, so I calculate. Then I compare record 2 to record 3 and do the same process. </p>