MySQL order by before group by

后端 未结 9 2263
梦谈多话
梦谈多话 2020-11-22 06:57

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

9条回答
  •  死守一世寂寞
    2020-11-22 07:33

    Try this one. Just get the list of latest post dates from each author. Thats it

    SELECT wp_posts.* FROM wp_posts WHERE wp_posts.post_status='publish'
    AND wp_posts.post_type='post' AND wp_posts.post_date IN(SELECT MAX(wp_posts.post_date) FROM wp_posts GROUP BY wp_posts.post_author) 
    

提交回复
热议问题