首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

sql 逆序 翻页,该怎么处理

2012-06-07 
sql 逆序 翻页我的翻页语句是SELECT top 每页个数 [userId] FROM [temp] where11and isCH 1andUserId no

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

热点排行