This piece of working sql gives me the position of an item in the subquery:
SELECT x.position
FROM
(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.