1、数据样图
2、sql语句
select * from [WeChatApp].[dbo].[Templates] where ID in( select _hour.ID from (select *,ROW_NUMBER()OVER( partition by Name order by Type desc) Rank from [WeChatApp].[dbo].[Templates])_hour where Rank=1)
3、查询结果
1、数据样图
2、sql语句
select * from [WeChatApp].[dbo].[Templates] where ID in( select _hour.ID from (select *,ROW_NUMBER()OVER( partition by Name order by Type desc) Rank from [WeChatApp].[dbo].[Templates])_hour where Rank=1)
3、查询结果