On Wed, May 20, 2009 at 3:57 AM, Ngoc Thanh Nguyen < [email protected]> wrote:
> > > - if you want all dataelements have ranges > > insert into minmaxdataelement(sourceid, dataelementid, minvalue, maxvalue) > select organisationunitid, dataelementid, 0, 99 from organisationunit, > dataelement > This will not run without modifications: ERROR: null value in column "minmaxdataelementid" violates not-null constraint You could probably make the id column serial to cope with that. Also, not sure if you should have the default value for categoryoptioncomboid or leave it as NULL. > - if you only want those dataelements belonging to datasets assigned to > certain orgunit > > insert into minmaxdataelement(sourceid, dataelementid, minvalue, maxvalue) > > select o.organisationunitid, dm.dataelementid, 0, 99 > from organisationunit o inner join datasetsource ds on o.organisationunitid > = ds.sourceid > inner join datasetmembers dm on dm.datasetid = ds.datasetid > This is better (with same comment as above). Knut
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : [email protected] Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp

