← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5211: script

 

------------------------------------------------------------
revno: 5211
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-11-24 10:54:47 +0100
message:
  script
modified:
  resources/sql/div.sql


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'resources/sql/div.sql'
--- resources/sql/div.sql	2011-11-24 09:18:23 +0000
+++ resources/sql/div.sql	2011-11-24 09:54:47 +0000
@@ -7,7 +7,7 @@
 on (cc.categoryoptioncomboid=co.categoryoptioncomboid)
 where categorycomboid=12414 );
 
--- Data elements and frequency with average agg operator (lower than yearly negative for data mart performance)
+-- Data elements and frequency with average agg operator (higher than yearly negative for data mart performance)
 
 select d.dataelementid, d.name, pt.name from dataelement d 
 join datasetmembers dsm on d.dataelementid=dsm.dataelementid 
@@ -21,3 +21,15 @@
 join dataelement d on dal.dataelementid=d.dataelementid 
 order by name, aggregationlevel;
 
+-- Data elements with less than 100 data values
+
+select de.dataelementid, de.name, (select count(*) from datavalue dv where de.dataelementid=dv.dataelementid) as count 
+from dataelement de
+where (select count(*) from datavalue dv where de.dataelementid=dv.dataelementid) < 100
+order by count;
+
+-- Number of data elements with less than 100 data values
+
+select count(*) from dataelement de
+where (select count(*) from datavalue dv where de.dataelementid=dv.dataelementid) < 100;
+