Notifications
Clear all
Topic starter
Was trying to analyze Race and Ethnicity data, and see Person.Ethnicitymid and Person.Racemid and both appear to print a number. What table do I look these up to to translate?
Posted : May 6, 2013 4:48 am
Anytime you see mid in the column name, it is referring to the MedLists table. For these particular columns on PatientProfile, you will need to JOIN like so:
SELECT race.Description, eth.Description
FROM PatientProfile pp
JOIN MedLists race ON pp.RaceMId = race.MedListsId AND race.TableName = 'Race'
JOIN MedLists eth ON pp.EthnicityMId = eth.MedListsId AND eth.TableName = 'Ethnicity'
The funky thing about MedLists is the TableName column. Most of the time, you don't have to worry about setting it to something, because the MedListsId is usually unique; however, in the CPS Database Data Trees they tell us to link it to a specific TableName in the documentation. So, I usually do just to be safe.
Posted : May 6, 2013 5:12 am