I have a table that holds Inpatient Data.
I need to determine if a patient has made re-occurring visits to the hospital in a 30 day period.
I have Patient ID, ServiceFromDate (SFD), ServiceToDate (STD), and DX.
A TRIP is considered if the patient returns to the hospital within 30 days of his/her last discharge date (STD).
Record 1 -Visit 1:
Record 2 - Visit 2:
I need to compare the STD of Record 1 to SFD of Record 2. If the total number of days between the two is 30 or less then return that record.
In the above scenario, this record WOULDN