I've got three tables that I'm working with: LOCATION (10 different locations), PATIENT_ENCOUNTERS (90k Patients) and PROVIDERS (80 providers). What I would like to do is:
For a given month (date range) pull TEN random patient encounters from the PATIENT_ENCOUNTERS table by LOCATION and then by PROVIDER.
I know how to pull random patient_encounters but where I am stuck is how to pull TEN random charts by LOCATION and then by PROVIDER. When I do my query, I simply get ten random. See below.
The goal is to have a single report sorted by LOCATION then by each PROVIDER... so, I should have a report with 800 patient encounters (80 providers times ten random encounters).
Any help in pointing me in the right direction would be appreciated.
SELECT TOP (10) location_mstr.location_name, provider_mstr.description, patient.med_rec_nbr,
person.last_name, person.first_name, person.____, person.ssn, person.date_of_birth,
FROM patient_encounter INNER JOIN
View Complete Post