按名字分组,按时间排序
select * FROM (
select row_number() over (partition by NAME order by DAT desc) rn ,name,dat
FROM QWER
) tn where tn.rn=1;
或
SELECT a.* from QWER a,
(SELECT name,max(dat) dat FROM QWER GROUP BY name) b where
a.tim=b.dat
and
b.name=a.name;