SQL - How To Order Using Count From Another Table

后端 未结 6 1588
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-31 04:39

1. Bloggers

blogger_id
1 
2
3

2. Posts

post_from_blogger_id
1 
1
1
2
2
3

As

6条回答
  •  走了就别回头了
    2021-01-31 04:57

    Use subqueries.

    select * from (
        select post_from_blogger_id, count(1) N from Posts
        group by post_from_blogger_id) t
    order by N desc
    

提交回复
热议问题