首页 > 开发 > 综合 > 正文

SQL分页语句

2024-07-21 02:31:50
字体:
来源:转载
供稿:网友

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

--方法一

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


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表