Better mode for do a 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/26 23:33 UTC
Read the original article Hit count: 173

Filed under:
|
|

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 is possible and how rewrite it for get better performance.

thanks

© Stack Overflow or respective owner

Related posts about group-by

Related posts about select