We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Can you use sub queries with phql?

This piece of working sql gives me the position of an item in the subquery:

SELECT x.position
(SELECT ftp.topic_id, ftp.id as id, @rownum := @rownum + 1 AS position
 FROM forum_topic_post ftp
 JOIN (SELECT @rownum := 0) r
 where ftp.topic_id = 11134
 ORDER BY ftp.id ASC) as x
where x.id = 310781

Is it possible now to transpose this into phql as previous reading has told me this is not possible.


Not like those, those are not supported, only subqueries to select column value are supported.