614. Second Degree Follower

# Write your MySQL query statement below
SELECT DISTINCT f2.follower,f1.num
FROM (SELECT followee, IFNULL(COUNT(DISTINCT followee,follower),0) AS num
FROM follow
GROUP BY followee) f1
INNER JOIN follow f2
ON f1.followee = f2.follower
ORDER BY f2.follower
;

posted @ 2018-12-20 03:45  yuesi  阅读(168)  评论(0编辑  收藏  举报