← Back to team overview

dhis2-users team mailing list archive

SQL protected Table Issue

 

Hello everyone,

 

I am having an issue creating a SQL view from the DHIS2 using this query. 

 

SELECT DISTINCT public._orgunitstructure.uidlevel4 AS UID4,
public._organisationunitgroupsetstructure.organisationunitname AS name4,
public._orgunitstructure.uidlevel5 AS UID5, public.organisationunit.name AS
orgUnitName, public.organisationunit.hierarchylevel AS orgUnitLevel,
public.trackedentityattributevalue.value AS woman,
public.trackedentityinstance.uid AS womanuid,
public.trackedentityinstance.created AS womancreationdate,
public.trackedentityinstance.lastupdated AS womanupdated 

FROM public.trackedentityattribute

INNER JOIN public.trackedentityattributevalue ON
(public.trackedentityattribute.trackedentityattributeid =
public.trackedentityattributevalue.trackedentityattributeid) 

INNER JOIN public.trackedentityinstance ON
(public.trackedentityattributevalue.trackedentityinstanceid =
public.trackedentityinstance.trackedentityinstanceid)

INNER JOIN public.organisationunit ON
(public.trackedentityinstance.organisationunitid =
public.organisationunit.organisationunitid)

LEFT JOIN public._orgunitstructure ON public._orgunitstructure.uidlevel5 =
public.organisationunit.uid

LEFT JOIN public._organisationunitgroupsetstructure ON
public._organisationunitgroupsetstructure.organisationunitid =
public.organisationunit.parentid

WHERE public.trackedentityattribute.name = 'Name of Member'

 

 

Please, any advice on how to go about this.

 

Thanks

John


Follow ups