What is the correct syntax for retrieving data using Self-reference in OQL?

0
Hi Mendix expert,   Im trying to retrieve data in OQL using a self-reference, see below the Xpath version of this retrieve, but I dont know how to format my OQL statement in the correct way. [Masterdata.ParentOrganisatie_Organisatie[reversed()] = $Organisatie or id = $Organisatie]   Could you help me with the correct syntax?   Thank you!   Tim
asked
1 answers
1

It's probably confusing to define what the parent(s) and child(ren) are in situations like this, but here are two possible ways.

From the 1 retrieve the many:
 

SELECT o/id
FROM Masterdata.Organisatie o
INNER JOIN o/Masterdata.ParentOrganisatie_Organisatie/Masterdata.Organisatie p ON p/id = blah

 

From ony of the many, retrieve the one:

SELECT p/id
FROM Masterdata.Organisatie o
INNER JOIN o/Masterdata.ParentOrganisatie_Organisatie/Masterdata.Organisatie p
WHERE o/id = blah

 

answered