Leetcode - 614. Second Degree Follower
문제
정답
SELECT DISTINCT Follow.follower, FC.num
FROM Follow
JOIN (
SELECT followee, count(*) AS num
FROM Follow
GROUP BY followee) AS FC
ON Follow.follower = FC.followee
ORDER BY Follow.follower
SELECT DISTINCT Follow.follower, FC.num
FROM Follow
JOIN (
SELECT followee, count(*) AS num
FROM Follow
GROUP BY followee) AS FC
ON Follow.follower = FC.followee
ORDER BY Follow.follower