← Back to team overview

dhis2-devs team mailing list archive

Re: [Dhis2-users] How to output all data element list with their categories option DHIS2 V2.23 using SQLview

 

Hi Vunda,

Try out the attached script.

regards,

Sam Kasozi
+256 788-993-565
Skype: sam.kasoziug

On Fri, Apr 7, 2017 at 1:00 PM, vunda limbe <vundalon@xxxxxxxxx> wrote:

> Hi everybody,
>
> I'm looking for SQL code to list data element name, id, uid,
> categoryoptioncombouid, categoryoptioncomboname.
> I don't know exactly wich table I have to insert in my query for listing
> the content.
>
> Your supports are welcome
>
> Thanks.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>
>
SELECT de.name as dataelementname, de.shortname as dataelementshortname, de.uid as de_uid, de.dataelementid, de.categorycomboid,
coc.name as cocname, coc.uid as cocuid, coc.categoryoptioncomboid, cc.categorycomboid, cc.name as ccname, cc.uid as ccuid 
FROM dataelement de LEFT JOIN categorycombos_optioncombos coccc on de.categorycomboid = coccc.categorycomboid
LEFT JOIN categorycombo cc ON coccc.categorycomboid = cc.categorycomboid
LEFT JOIN categoryoptioncombo coc ON coccc.categoryoptioncomboid = coc.categoryoptioncomboid
ORDER BY de.dataelementid

Follow ups

References