You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
798 B
SQL
30 lines
798 B
SQL
/***************CREATE VIEWS*******************/
|
|
create view if not exists
|
|
history.match_drugs_to_trials as
|
|
select nct_id, rxcui, propvalue1
|
|
from
|
|
ctgov.browse_interventions as bi
|
|
join
|
|
rxnorm_migrated.rxnorm_props as rp
|
|
on bi.downcase_mesh_term = rp.propvalue1
|
|
where
|
|
propname='RxNorm Name'
|
|
and
|
|
nct_id in (select nct_id from history.trial_snapshots)
|
|
;
|
|
|
|
|
|
/********************IN DEVLEOPMENT*********************/
|
|
|
|
/* Get the count of brand names attached to each trial
|
|
* I should develop this into a view that matches trials to brands
|
|
* then create a view that gets the counts.
|
|
*/
|
|
select rxcui1,count(rxcui2) from rxnorm_migrated.rxnorm_relations rr
|
|
where
|
|
rxcui1 in (select rxcui from history.match_drugs_to_trials)
|
|
and
|
|
tty2 = 'BN'
|
|
group by rxcui1
|
|
order by count(rxcui2) desc
|
|
; |