Last active
March 20, 2018 02:09
-
-
Save wetherc/7ea601711f9605a40e30d8950a2324da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
s.nct_id, | |
s.brief_title, | |
s.phase, | |
s.enrollment, | |
s.start_date, | |
s.primary_completion_date, | |
s.last_update_submitted_date, | |
sp.name, | |
sp.agency_class, | |
i.name | |
FROM studies s | |
-- Find who is sponsoring the trial | |
JOIN sponsors sp | |
ON s.nct_id = sp.nct_id | |
-- Get details on the drug intervention | |
JOIN interventions i | |
ON s.nct_id = i.nct_id | |
-- Add in keyword searches | |
JOIN detailed_descriptions dd | |
ON s.nct_id = dd.nct_id | |
-- Filter based on various criteria | |
WHERE sp.lead_or_collaborator = 'lead' | |
AND s.phase NOT LIKE '%1%' | |
AND s.phase NOT LIKE '%2%' | |
AND s.phase != 'N/A' | |
AND s.phase IS NOT NULL | |
AND i.intervention_type = 'Drug' | |
AND sp.agency_class = 'Industry' | |
AND ( | |
dd.description LIKE '%KEYWORD%' | |
-- Just duplicate this line for each keyword | |
OR dd.description LIKE '%KEYWORD2%' | |
) | |
ORDER BY | |
s.completion_date desc, | |
s.last_update_submitted_date desc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment