select t.name1,t.name2,t.zx
from (select row_number()over(partition by name1 order by zx desc)rn, test.* from test)t
where t.rn=1;
其中partition by 和group by 类似,name1可以是多个,
如partition by userName,userId
order by 是排序zx同样
可以是多个,
如 order by createDate desc,userName desc。