I am working on a simple forum in symfony2 and have the following DQL query to get the last posts in each forum:
SELECT p, f.id FROM MyBundle:Post p
JOIN p.forum f
GROUP BY p.forum
HAVING p.created_at >= MAX(p.created_at)
Without the HAVING clause it works and fetches the first posts but thats not what I want.
What am I doing wrong here? Is this even possible using DQL?