I'm new in Phalcon and I don't know how to translate this query to Phalcon Query, It tooks me 3 hours with many searchs.
select sp.* FROM subplan sp INNER JOIN (SELECT subid, MAX(enddate) AS MaxDateTime FROM subplan WHERE status = 3 GROUP BY subid) groupedtt ON sp.subid = groupedtt.subid AND sp.enddate = groupedtt.MaxDateTime
Can anyone help me with that? Thank you!