dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #13868
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4563: Added sql util
------------------------------------------------------------
revno: 4563
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2011-09-11 22:23:37 +0200
message:
Added sql util
modified:
resources/sql/integritychecks.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/integritychecks.sql'
--- resources/sql/integritychecks.sql 2011-08-05 14:06:08 +0000
+++ resources/sql/integritychecks.sql 2011-09-11 20:23:37 +0000
@@ -14,6 +14,13 @@
join section sc on(sd.sectionid=sc.sectionid)
where sc.name = 'OPD Diagnoses';
+-- Get data elements and number of data values sorted ascending
+
+select distinct d.dataelementid, d.name, count(v.*) as cnt from datavalue v
+join dataelement d on(v.dataelementid=d.dataelementid)
+group by d.dataelementid, d.name
+order by cnt asc;
+
-- Get dataset memberships for data elements with more than one membership
select de.name, ds.name from dataelement de