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 sub_id, MAX(end_date) AS MaxDateTime FROM subplan WHERE status = 3 GROUP BY sub_id) groupedtt ON sp.sub_id = groupedtt.sub_id AND sp.end_date = groupedtt.MaxDateTime
Can anyone help me with that? Thank you!