=== 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' );