Dette burde gøre det:
SELECT p.id
FROM post p
LEFT JOIN comment c on c.post_id = p.id
GROUP BY p.id
ORDER BY COALESCE(GREATEST(p.created, MAX(c.created)), p.created) DESC
Hvis vi antager, at en kommentar altid er ældre end opslaget, kan vi forenkle:
SELECT p.id
FROM post p
LEFT JOIN comment c on c.post_id = p.id
GROUP BY p.id
ORDER BY COALESCE(MAX(c.created), p.created) DESC