WEB开发网      好站好分享!你的一份分享是我们的一份动力;请分享 ---﹥
开发学院数据库MSSQL Server SQL分页语句 阅读

SQL分页语句

 2007-05-31 15:22:14 来源:WEB开发网 减小字体增大字体】  关注谷汶锴的微博
核心提示:-前提是必需有一列是自动增长类型,唯一性--方法一SELECT DISTINCT TOP 8 CategoryIDFROM tbl_Product_ProductsWHERE (UserID = 73) AND (CategoryID >(SELECT MAX(categoryid)FROM (SELECT DI

-前提是必需有一列是自动增长类型,唯一性

--方法一

SELECT DISTINCT TOP 8 CategoryID
FROM tbl_Product_Products
WHERE (UserID = 73) AND (CategoryID >
(SELECT MAX(categoryid)
FROM (SELECT DISTINCT TOP 16 categoryid
FROM tbl_product_products where userid=73
ORDER BY categoryid) AS b))
ORDER BY CategoryID

--方法二

select top 10 * from [order details]
where orderid>all(select top 10 orderid from [order details] order by orderid)
order by orderid

Tags:SQL 语句

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接