← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6470: Sql

 

------------------------------------------------------------
revno: 6470
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-04-03 12:37:31 +0200
message:
  Sql
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	2012-02-26 18:28:52 +0000
+++ resources/sql/div.sql	2012-04-03 10:37:31 +0000
@@ -57,3 +57,14 @@
 where ou.organisationunitid=om.organisationunitid
 and om.orgunitgroupid=22755);
 
+-- Facility overview --
+
+select ou.name, ou.uid, ou.code, ou.coordinates, oustr.level, gsstr.type, gsstr.ownership, 
+  (select name from organisationunit where organisationunitid=oustr.idlevel2) as province,
+  (select name from organisationunit where organisationunitid=oustr.idlevel3) as county,
+  (select name from organisationunit where organisationunitid=oustr.idlevel4) as district
+from _orgunitstructure as oustr
+join organisationunit as ou on oustr.organisationunitid=ou.organisationunitid
+join _organisationunitgroupsetstructure as gsstr on ou.organisationunitid=gsstr.organisationunitid
+where oustr.level >= 5;
+