Ini harus melakukannya:
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
Jika kita berasumsi bahwa komentar selalu lebih tua dari postingan, kita dapat menyederhanakannya:
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