← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16956: SQL

 

------------------------------------------------------------
revno: 16956
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2014-10-04 14:27:48 +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	2014-09-29 09:57:47 +0000
+++ resources/sql/div.sql	2014-10-04 12:27:48 +0000
@@ -255,3 +255,12 @@
 $$ language plpgsql;
 
 select setrandomcode();
+
+-- (Write) Remove data elements from data sets which are not part of sections
+
+delete from datasetmembers dsm
+where dataelementid not in (
+  select dataelementid from sectiondataelements ds
+  inner join section s on (ds.sectionid=s.sectionid)
+  where s.datasetid=dsm.datasetid)
+and dsm.datasetid=1979200;