如何使用MySQL对作者的投稿、评论、录用和访问量进行汇总,并取出排名前五位的作者? |
SELECT author, SUM(post_count) AS total_posts, SUM(comment_count) AS total_comments, SUM(accept_count) AS total_accepted, SUM(view_count) AS total_views FROM article GROUP BY author ORDER BY total_posts DESC, total_comments DESC, total_accepted DESC, total_views DESC LIMIT 5;