← Back to team overview

dhis2-users team mailing list archive

SQL View to output all levels of orgUnits

 

Dear Community,

I am trying to output a list of all the orgUnits from the SQLView (DHIS2
2.24). I would like to have all the information of all the levels of the
orgUnits for each of the  6 levels implemented. I would like to have a
result in the following form:

orgUnitName (level6), orgUnitName (level5), orgUnitName (level4),
orgUnitName (level3), orgUnitName (level2), orgUnitName (level1)

I have used the following code to output all the information of the level 6:

SELECT organisationunit.organisationunitid, organisationunit.uid,
organisationunit.code, organisationunit.name, organisationunit.shortname
FROM public.organisationunit, public._orgunitstructure WHERE
organisationunit.organisationunitid = _orgunitstructure.idlevel6 AND
organisationunit.code is not null;


How should I update this code in order to pull out the desired output?

Thank you for your support!

Best,

Tantely

-- 
*This message and its attachments are confidential and solely for the 
intended recipients. If received in error, please delete them and notify 
the sender via reply e-mail immediately.*

Follow ups