Write a solution to find the people who have the most friends and the most friends number.
The test cases are generated so that only one person has the most friends.
The result format is in the following example.
UNION
, UNION ALL
이 아직은 친숙하지 않아서 헤맸다.UNION ALL
은 모든 중복값을 그대로 출력해준다.LIMIT 1
을 통해 제일 첫 번째를 출력한다.SELECT id, COUNT(*) AS num
FROM (
SELECT requester_id AS id FROM RequestAccepted
UNION ALL
SELECT accepter_id AS id FROM RequestAccepted
) AS FC
GROUP BY id
ORDER BY num DESC
LIMIT 1