sql 分页
最简单的分页(没考虑效率)
SELECT TOP 10 [Id],[ReflectionId],[CreatorUserId],[Type],[Text],[AttachmentsJson],[CreatedTime] FROM [LeadersCorporationDB].[dbo].[ReflectionLog] WHERE [ReflectionId]='2769D3CB-BB5C-47A1-9BF3-00C16614C4EB' AND Id NOT IN(SELECT TOP ((2-1)*10+1) Id FROM [LeadersCorporationDB].[dbo].[ReflectionLog] WHERE [ReflectionId]='2769D3CB-BB5C-47A1-9BF3-00C16614C4EB' ORDER BY CreatedTime) ORDER BY CreatedTime
NOT IN里边的条件、排序规则要和外层的相同!!!!
posted on 2014-02-14 11:23 paul_cheung 阅读(93) 评论(0) 编辑 收藏 举报