dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #10940
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3016: Added util sql script
------------------------------------------------------------
revno: 3016
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2011-03-13 23:45:22 +0100
message:
Added util sql script
added:
resources/sql/movedata.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
=== added file 'resources/sql/movedata.sql'
--- resources/sql/movedata.sql 1970-01-01 00:00:00 +0000
+++ resources/sql/movedata.sql 2011-03-13 22:45:22 +0000
@@ -0,0 +1,17 @@
+
+-- Move population data from last year to this year
+
+-- Replace first periodid with current year, replace second periodid with last year, replace dataset.name with population dataset name
+
+delete from datavalue where periodid=43668 and dataelementid in (
+select dataelementid from datasetmembers
+join dataset using(datasetid)
+where dataset.name='Population estimates' );
+
+insert into datavalue(dataelementid,periodid,sourceid,categoryoptioncomboid,value,storedby,lastupdated,comment,followup)
+select dataelementid,43668 as periodid,sourceid,categoryoptioncomboid,value,storedby,lastupdated,comment,followup
+from datavalue
+where periodid=21011 and dataelementid in (
+select dataelementid from datasetmembers
+join dataset using(datasetid)
+where dataset.name='Population estimates' );