T-SQL百万记录中分组取最大值方法ROW_NUMBER() OVER()
摘要:
SELECT SysUserID, UserID, ROW_NUMBER() OVER(PARTITION BY UserID ORDER BY AddTime DESC) AS numsFROM dbo.AssignHistoryLog WHERE AssignType = 2AND SysUserID IN (SELECT userid FROM jdrcadmin.admin WHERE deptId IN (17,18,57,80,33) AND isValid=1)查询结果如下图: 阅读全文
posted @ 2014-02-11 11:53 loveking_阳 阅读(644) 评论(0) 推荐(0) 编辑