码迷,mamicode.com
首页 > 数据库 > 详细

sql里面的分页

时间:2015-12-15 01:03:51      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:

SELECT TOP 5 * FROM hos_house WHERE HMID NOT IN(
SELECT TOP 5 HMID FROM hos_house WHERE PRICE>2500 ORDER BY PRICE
) AND PRICE>2500 ORDER BY PRICE

-----注释:只对sqlsever2005版本以上的支持---

SELECT * FROM (
SELECT *, row_no = ROW_NUMBER() OVER(ORDER BY PRICE)
FROM hos_house
WHERE PRICE>2500
) a
WHERE row_no BETWEEN 6 AND 10

sql里面的分页

标签:

原文地址:http://www.cnblogs.com/Allen974103107/p/5046930.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!