忘了写表名了
select *
from
(select product_name,product_subname,row_number()over(partition by product_name order by index desc) px
from tb
where 条件) A
where A.px=1
取最小,反desc改成asc
取最大:
select *
from
(select product_name,product_subname,row_number()over(partition by product_name order by index desc) px) A
where A.px=1
取最小,反desc改成asc