I have the following query
SELECT PatientProfile.PatientId, PatientProfile.First, PatientProfile.Middle, PatientProfile.Last, PatientProfile.SSN, PatientProfile.Birthdate,DoctorFacility.ListName, DoctorFacility.Phone2, DoctorFacility.Phone2Type FROM PatientProfile LEFT JOIN DoctorFacility ON PatientProfile.RefDoctorId = DoctorFacility.DoctorFacilityId WHERE PatientProfile.PatientID='<<Subject ID>>'
I would Like to change the query based on another field <<Dept>> for example if the <<Dept>> is lets say 3 I would Like to append alpha characters mwt to the beginning of <<Subject ID>> for the lookup clause. Would I do this with a case statement? if so could someone give me an example of how to do this. I will have about 10 different dept codes all with different alpha values I will have to append to the beggining of the <<subject ID>>
Thanks for Any Help
SELECT PatientProfile.PatientId, PatientProfile.First, PatientProfile.Middle, PatientProfile.Last, PatientProfile.SSN, PatientProfile.Birthdate,DoctorFacility.ListName, DoctorFacility.Phone2, DoctorFacility.Phone2Type FROM PatientProfile LEFT JOIN DoctorFacility ON PatientProfile.RefDoctorId = DoctorFacility.DoctorFacilityId WHERE PatientProfile.PatientID='<<Subject ID>>'
I would Like to change the query based on another field <<Dept>> for example if the <<Dept>> is lets say 3 I would Like to append alpha characters mwt to the beginning of <<Subject ID>> for the lookup clause. Would I do this with a case statement? if so could someone give me an example of how to do this. I will have about 10 different dept codes all with different alpha values I will have to append to the beggining of the <<subject ID>>
Thanks for Any Help