Oracle 分组排序取第一条
select r.user_id,r.user_name,r.user_age,r.least_time
from (select t.user_id,t.user_name,t.user_age,t.least_time,row_number() over(
partition by t.user_id order by t.least_time )rn
from t_user_login t
where t.status=0)r
where r.rn=1
over(partition by t.user_id)按照用户id分区
参考资料 http://www.cnblogs.com/lanzi/archive/2010/10/26/1861338.html