Ad-hoc Query: Count of NCI Sponsored Trials with Grant Numbers -------------------------------------------------------------- Old Version =========== select count(distinct q.doc_id) FROM query_Term q, docs_with_pub_status d, query_term q1 WHERE q.doc_id=d.doc_id and q.doc_id = q1.doc_id AND q.path = '/InScopeProtocol/FundingInfo/NIHGrantContract/GrantContractNo' AND d.pv='Y' and q1.path = '/InScopeProtocol/ProtocolSponsors/SponsorName' and q1.value = 'NCI' New Version =========== SELECT count(distinct q.doc_id) FROM query_Term q JOIN docs_with_pub_status d ON d.doc_id = q.doc_id AND d.pv = 'Y' JOIN query_term q1 ON q1.doc_id = q.doc_id AND (q1.path = '/InScopeProtocol' + '/ProtocolSponsors/SponsorName' OR q1.path = '/CTGovProtocol/Sponsors' + '/PDQSponsorship' ) AND q1.value = 'NCI' WHERE q.path = '/InScopeProtocol/FundingInfo' + '/NIHGrantContract/GrantContractNo' OR q.path = '/CTGovProtocol/PDQAdminInfo' + '/FundingInfo/NIHGrantContract' + '/GrantContractNo'