There are plenty of similar questions to be found on here but I don\'t think that any answer the question adequately.
I\'ll continue from the current most popular qu
** Sub queries may have a bad impact on performance when used with large datasets **
Original query
SELECT wp_posts.*
FROM wp_posts
WHERE wp_posts.post_status = 'publish'
AND wp_posts.post_type = 'post'
GROUP BY wp_posts.post_author
ORDER BY wp_posts.post_date DESC;
Modified query
SELECT p.post_status,
p.post_type,
Max(p.post_date),
p.post_author
FROM wp_posts P
WHERE p.post_status = "publish"
AND p.post_type = "post"
GROUP BY p.post_author
ORDER BY p.post_date;
becasue i'm using max
in the select clause
==> max(p.post_date)
it is possible to avoid sub select queries and order by the max column after the group by.