Query help for Inpatient, Outpatient and Alternate Care data for letters..
Posted on 2013-11-13
I want to know the best way to approach this scenario.
I currently have written a sql statement with 3 big select statements that are joined by a UNION statement like:
Select Inpatient data
Select Outpatient data
Select Alternate Care data
This works fine for creating a file for a single letter that would be generated for each patient or case.
Now, the specs have changed where there needs to be a letter generated for each
A Mail-to-Type is defined as - 'Facility', 'Doctor' and 'Patient'.
So basically I need a letter now for each Mail to Type to print and the current logic I have will not do this.
In other words, 3 letters are to be generated for each mail-to-type, not just one. Or can I still keep the same logic above to print out a letter for each mail-to-type?
I tried the scenario like this for the Inpatient data:
Select Inpatient - Facility
Select Inpatient - Doctor
Select Inpatient - Patient
But this seems to not work, any other suggestions?