将一个表按RMB003分组,按RMB001排序,获取排序row等于1的记录;
select * from
(
select RMB001,RMB002,RMB003,ROW_NUMBER() over(PARTITION by RMB003 order by RMB001 desc) as row from USERMB
) T where T.row <= 1 order by RMB003
将一个表按RMB003分组,按RMB001排序,获取排序row等于1的记录;
select * from
(
select RMB001,RMB002,RMB003,ROW_NUMBER() over(PARTITION by RMB003 order by RMB001 desc) as row from USERMB
) T where T.row <= 1 order by RMB003