日期:2014-05-17  浏览次数:20365 次

sql 逆序 翻页

我的翻页语句是

SELECT top 每页个数 [userId] FROM [temp] where  1=1  and isCH= 1   and  UserId not in (select top 页数*每页个数 UserId from temp where  1=1  and isCH= 1  order by upTime desc )  order by upTime desc 


后来发现查询结果不对!

select top 页数*每页个数 UserId from temp where  1=1  and isCH= 1  order by upTime desc

后来发现这个语句 top 40 和top 60 查出来的前40的数据不一样!所以翻页的数据就出现问题了,
正确的该怎么写?

------解决方案--------------------
希望对你有用
http://blog.csdn.net/taomanman/article/details/7481838