当前位置:网站首页>leetcodeSQL:602. Friend application II: who has the most friends

leetcodeSQL:602. Friend application II: who has the most friends

2022-06-12 18:59:00 Review of the white speed Dragon King

 Insert picture description here
Ideas :
Turn the watch upside down union once
then groupby count Just fine

sql

# Write your MySQL query statement belowse
select l1 as id, count(l1) as num
from
(
    select requester_id as l1, accepter_id as l2
    from RequestAccepted
    Union #  Remove duplication 
    select accepter_id as l1, requester_id as l2
    from RequestAccepted
) t
group by l1
order by num DESC
limit 1
原网站

版权声明
本文为[Review of the white speed Dragon King]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202281554558205.html