select * from test;
no | time | name |
1001 | 20141226 | zhangsan |
1001 | 20141227 | lisi |
1002 | 20141228 | wangwu |
1002 | 20141229 | zhaoliu |
select * from (select rank() over(partition by documentno order by time desc) r,a.* from test
a) where r=1;
no
time name
----- ----------- ----------
1001 20141227 lisi
1002 20141229 zhaoliu
时间: 2024-10-17 23:54:12