Better mode for do a 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 is possible and how rewrite it for get better performance.
thanks