OQL JOIN on Associations

2
How do I join 2 entities via an Association constraint? Its easy enough to join ON 2 visible fields, and likewise in normal SQL using the intermediary tables entity_entity on their pseudo id columns. Could someone give me an example what the ON part looks like in SELECT MyModule.PARENT.Name FROM MyModule.PARENT INNER JOIN MyModule.CHILD ON ??
asked
2 answers
8

OQL is different from SQL in that it allows you to use the associations instead of joining tables 'ON'. This allows you to Join over the associations eg:

SELECT family.Name, family.ChildName, family.ChildAge
FROM MyModule.Parent AS par
INNER JOIN par/Parent_Child/MyModule.Child AS family

EDIT: I would also suggest you to always alias your results, it just makes it easier to understand and less likely to make a mistake.

answered
-2

For an example:

SELECT MyModule.PARENT.Name

FROM MyModule.PARENT AS PARENT

INNER JOIN MyModule.CHILD AS CHILD

ON CHILD/MyModule.CHILD_PARENT/MyModule.PARENT/ID = PARENT/ID

answered