Hi all, I'd like to re-use a certain field in an OQL subquery that is defined in the main table / column. So I define an Object in the main query and I would like to use an attribute of that main object in the WHERE clause of the sub-query. MySQL would give me: SELECT p1.sitename, (SELECT MAX(filesize) FROM pages p2 WHERE p1.siteid = p2.siteid) subquery2 FROM pages p1; However doing the same in Mendix OQL would give the error that p1 cannot be reached from that particular Subquery scope. So: How can I use my first object as a constraint for a subquery FROM?
Can you try the following?
SELECT p1.sitename, (SELECT MAX(filesize) FROM module.pages AS p2 WHERE p1.siteid = p2.siteid) AS subquery2 FROM module.pages AS p1;