SqlServer 分页 写法


一、

SELECT * FROM
    (SELECT ROW_NUMBER() OVER(ORDER BY id) AS RowId,* FROM Article  where cid in (3,4,5,6,7,8,9,10,11,12 )) AS r
WHERE  RowId  BETWEEN 1 and 12

 

二、
select * from
(
    select  ROW_NUMBER() OVER(ORDER BY id) as rowid,*  from
    (
    select * from article where cid in (3,4,5,6,7,8,9,10,11,12)  
    ) as t1
) as t2  where  t2.rowid between 1 and 12


posted @ 2023-07-15 16:04  DJ的魔鬼邂逅  阅读(22)  评论(0)    收藏  举报