select * from
(
select aa.person_id,aa.ip,aa.c,row_number() over(partition by aa.person_id order by aa.c desc) rn
from
(select t.person_id,t.ip,count(*) c
from log_book t
where t.logtype=1
group by t.person_id,t.ip
order by t.person_id,count(*) desc) aa
)
where rn > 1
一个sql简单关于分组的sql
最新推荐文章于 2018-09-20 16:53:44 发布