Hi All,
I was hoping you could help me out with a problem. I have a database containing 2 years of healthcare data.
I have several tables:
- all_hospital_admissions
- first_hospital_admissions
- emergency_department_attendances
I want to find out how many emergency department attendances a patient has had 6 month previous to their first hospital admission and 6 month post their first hospital admission.
The date of their first hospital admission is stored in the 'first_hospital_admissions' table as the field name 'date_of_admission'
The date of emergency department attendances are stored in the 'emergency_department_attendances' table as 'date_of_attendance'
The patient ID is in all tables (patient_id)
How do I make a query to check this?
The other problem is that a patient may have attended the emergency department the day before or on the same day as the first hospital admission. Ideally I would like to remove these emergency department attendances from the count. Is this possible?
Any help would be greatly appreciated!
Thank you!
:-)