mysql基础
企业面试题1
代码
sql
select m.id,m.num
from
(
select t.id as id,count(1) num
from
(
select ra.requester_id as id
from RequestAccepted ra
union all
select ra.accepter_id as id
from RequestAccepted ra
) t
group by t.id
) m
group by id
order by num desc,id
limit 1
结果
总结
select from union union all where group by having order by limit