Command sql

Hi Community

What is the command SQL to select data tracker in dhis2 please?
thanks a lot


Hi @crakotondramanitra,

Question is what are you trying to get? Just data or something else?
I would suggest you to get all data with api point … /api/trackedEntityInstances.json?fields=*&ou=your-ou-id
Then you can process this data in js or nay other language as you wish


Hi @Ulanbek

We will delete the data in the tracker for an organisation unit. I already use postman but there is an access error.
I don’t have direct access to postgres either. So my idea is to use the SQL query in dhis2 to delete them.


I wouldn’t suggest you delete TEIs directly, as TEI has multiple connections to other tables. Instead with the help of postman soft delete your TEIs, and then execute DataAdministration=> Maintenance by ticking following positions

This way is more safe

Good luck

Hi @Ulanbek ,
I tried with postman, the result is::


the command “delete” is not unexecuted