If we wanted to get all the ages for patients have a Cholesterol lab, we could run the following query:
WHERE CONCEPT_CD LIKE 'DEM|Age%'
AND PATIENT_NUM IN
WHERE CONCEPT_CD IN
WHERE CONCEPT_PATH LIKE '%LAB(LLB16) Chemistry(LLB17) Lipid Tests\CHOL%'
Notice how the path of the concept is used to query all concept ids that fall into the cholesterol group. If we only wanted to query for patient with Plasma Cholesterol only we would use the same query with the following path joined against C_FULLNAME:
'%LAB(LLB16) Chemistry(LLB17) Lipid Tests\CHOL\MCSQ-PCHOL%'
'%LAB(LLB16) Chemistry(LLB17) Lipid Tests\CHOL\MCPCHOL%'