Drug Exposure‎ > ‎

DEX30: Counts of number of distinct drugs persons take

This query is used to count the number of different distinct drugs (drug_concept_id) of all exposed persons. The input to the query is a value (or a comma-separated list of values) for a number of drug concepts. If the input is omitted, all possible values are summarized.

Input:
 Parameter  Example  Mandatory  Notes
drug_concept_id 15, 22 Yes

Sample query run:
The following is a sample run of the query. The input parameters are highlighted in blue

SELECT count(distinct t.drug_concept_id)  AS stat_value, t.person_id
FROM drug_exposure t 
group by t.person_id
having count(distinct t.drug_concept_id) in (15,22)
;
Output:
Output field list:
 Field  Description
drug_concept_id A foreign key that refers to a standard concept identifier in the vocabulary for the drug concept.
person_id A foreign key identifier to the person who is subjected to the drug. The demographic details of that person are stored in the person table.
count The number of individual drug exposure occurrences used to construct the drug era.

Sample output record:
 Field  Description
drug_concept_id  
person  
count  
Comments