select uid,cnt from
(
select uid,count(1) as cnt,
rank()over(order by count(1) desc) as count_num
 from
(
select trace_id,uid from user_client_log
group by trace_id,uid) as t1
group by uid) as t2
order by count_num asc,uid asc
limit 3