分组依据一列数据的最大或者最小值查询查询其他列对应数据

   
   select * from ( select ROW_NUMBER() over(partition  by ProductTypeID  order by SortCode  desc  ) rum,* from dbo.T_ProductType_Img img where img.IsDelete='False' 
    ) tem where rum=1

 

posted @ 2016-06-21 15:38  苦逼面条  阅读(391)  评论(0编辑  收藏  举报