Skip to content

Commit 0b2ec06

Browse files
committed
Update 602. Friend Requests II.sql
1 parent 62345d5 commit 0b2ec06

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

LeetCode SQL 50 Solution/602. Friend Requests II.sql

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,15 @@ Follow up: In the real world, multiple people could have the same most number of
5353

5454

5555

56+
# Write your MySQL query statement below
57+
WITH
58+
T AS (
59+
SELECT requester_id, accepter_id FROM RequestAccepted
60+
UNION ALL
61+
SELECT accepter_id, requester_id FROM RequestAccepted
62+
)
63+
SELECT requester_id AS id, COUNT(1) AS num
64+
FROM T
65+
GROUP BY 1
66+
ORDER BY 2 DESC
67+
LIMIT 1;

0 commit comments

Comments
 (0)