Better way to do SELECT with GROUP BY
Posted
by Luca Romagnoli
on Stack Overflow
See other posts from Stack Overflow
or by Luca Romagnoli
Published on 2010-03-26T23:29:19Z
Indexed on
2010/03/27
13:33 UTC
Read the original article
Hit count: 285
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
© Stack Overflow or respective owner