2013年12月26日

sql server分组查询并查询出每组的前几行数据

摘要: select [PR_ID] ,[PR_TypeID] ,[PR_Name] ,[PR_PicUrl] ,[PR_PicName] ,[PR_PLID]from(select [PR_ID] ,[PR_TypeID] ,[PR_Name] ,[PR_PicUrl] ,[PR_PicName] ,[PR_PLID],rn=ROW_NUMBER() over(partition by PR_TypeID order by PR_ID desc) from BT_ProductInfo where PR_PLID='2')twhere rn<=5 阅读全文

posted @ 2013-12-26 10:09 西湖雨 阅读(477) 评论(0) 推荐(0)

导航