diff --git a/sla/resources/queries/sla/ProtocolProjectsUsage.sql b/sla/resources/queries/sla/ProtocolProjectsUsage.sql index 88c336188..8198db54c 100644 --- a/sla/resources/queries/sla/ProtocolProjectsUsage.sql +++ b/sla/resources/queries/sla/ProtocolProjectsUsage.sql @@ -34,7 +34,7 @@ LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.pr --Ignore the gender when counting the usage if the approval data gender is: "Male or Female". Count both Male and Female usage. (SELECT i.protocol,pd.species,sum(animalsreceived) AS NumUsed FROM sla.purchasedetails pd, sla.purchase p, Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.project i, - Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals_BreedingGroups aa1 + Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals aa1 Where p.project = i.project AND p.objectid = pd.purchaseid AND aa1.protocol = i.protocol AND aa1.species = pd.species AND aa1.gender = 'Male or Female' AND animalsreceived IS NOT NULL @@ -107,7 +107,7 @@ LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.pr -- Count only the usage for the "Male" or "Female" gender (SELECT i.protocol,pd.species,pd.gender,sum(animalsreceived) AS NumUsed FROM sla.purchasedetails pd, sla.purchase p, Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.project i, - Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals_BreedingGroups aa1 + Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals aa1 Where p.project = i.project AND p.objectid = pd.purchaseid AND aa1.protocol = i.protocol AND aa1.species = pd.species AND aa1.gender = pd.gender AND aa1.gender <> 'Male or Female' AND animalsreceived IS NOT NULL