Another Date Difference Question

  • I need to identify patients readmitted to a hospital within 30 days from a table showing all admissions for a year.  I have AdmitDate & DCDate for each admission, along with a PatientID.  How can I differentiate Admits for the same patient within 30 days of last discharge?

    Thanks.  Hope the question is not too sparse on details.

  • Join table yo itself on

    T1.AdmissionDate > T2.AdmissionDate AND T1.AdmissionDate <= T2.AdmissionDate + 30

    And select what you need from T1.

    T1 and T2 are aliases for the same table.

    _____________
    Code for TallyGenerator

  • Well, it is a bit sparse :-). Table name and some column names would make the job easier.

    But if you get the idea Sergiy posted, you should be able to write the query now (if DCDate is discharge date then probably it will be T2.DCDate instead of T2.AdmissionDate.. but that's up to you now). If you have any problems,  post DDL and the query, we will look into it once more.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply