Better way to do SELECT with GROUP BY
- by Luca Romagnoli
Hi i've wrote a query that works:
SELECT `comments`.* FROM `comments`
RIGHT JOIN (SELECT MAX( id ) AS id, core_id, topic_id
FROM comments GROUP BY core_id, topic_id order by id desc) comm
ON comm.id = comments.id LIMIT 10
I want know if it is possible (and how) to rewrite it to get better performance.
Thanks