title: Counting Readmissions in SQL
body: <p>I am trying to count the patient readmissions in my set of data but have to do so using SQL. I am having trouble and hoped someone could point me in the right direction. My data appears like so</p>
  
  <blockquote>
    <p>>
    ID &nbsp;&nbsp;FirstDateofService&nbsp; LastDateofService&nbsp;PerformingProvider&nbsp;etc.(more irrelevant rows)<br>
    2202&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;2012-09-18&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;2012-09-21 &nbsp;&nbsp; &nbsp; &nbsp;&nbsp;St. Luke's<br>
    2202&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;2012-09-29&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;2012-10-04 &nbsp;&nbsp; &nbsp; &nbsp;&nbsp;St. Luke's<br>
    4280&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;2012-09-19 &nbsp;&nbsp; &nbsp; &nbsp;&nbsp;2012-09-20&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;Seton<br>
    4280&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;2012-09-19&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;2012-10-18&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;Seton<br>
    4280&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;2012-09-21&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;2012-10-09&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;Seton<br>
    4280&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;2012-10-10&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;2012-10-17&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;Seton<br>
    8980&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;2013-06-20&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;2013-06-24&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;Denton Regional<br>
    8980&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;2013-07-06&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;2013-07-06&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;Denton Regional  </p>
  </blockquote>
  
  <p>And the data goes on and on. I am trying to write a query to count the number of re-admissions (would like to do it per ID) where a re-admission is constituted by being admitted after 30 days or less from being released from the same hospital. I have tried many ways but cannot come up with accurate results. Any suggestions would be appreciated. Thank you.</p>