Friday, June 25, 2010

Notes on Generating the Names of FIs

One missing feature of the PDMS for now is the capability to generate the names of the Field Interviewers who conducted the survey on a certain year.

To do this, you have to link the survey table with the household table, then the household table with the location table.

Sample Code
SELECT DISTINCT s.enumeratorlastname LastName, s.enumeratorfirstname FirstName, pl.locationname Municipality
FROM survey s, household h, location l, location ll, location pl, surveydate sd
WHERE s.householdid = h.householdid AND h.locationid = l.locationid
AND ll.locationid = l.parentid AND pl.locationid = ll.parentid AND s.surveydateid = s.surveydateid
AND pl.locationname = "Sagbayan" AND sd.surveyyear = 2004
ORDER BY LastName;

No comments:

Post a Comment