二種sql分頁查詢語句分享

2022-09-24 14:06:16 字數 482 閱讀 9265

根據題意理解:

本質就是寫分頁查詢:

每頁條數:10條;

當前頁碼:4頁;

複製** **如下:mikudhpj

//第一種:

select * from

(select row_number() over(ordwww.cppcns.comer by id ascwww.cppcns.com) as num,* from userinfo)as u

where u.num

between

10*and

10*4

//第二種:

selec top 10 * from userinfo

where id not in

(select top (10*3) id from userinfo order by id)

order by id

本文標題: 二種sql分頁查詢語句分享

本文位址:

SQL語句分頁查詢

關於sql語句分頁,網上也有很多啦,我貼一部分過來,並且總結自己已知的分頁到下面,方便日後查閱。方法1 適用於 sql server 2000 2005 1 select top 頁大小 2from table1 3where id not in4 5select top 頁大小 頁數 1 id f...

SQL分頁查詢語句

有關分頁 sql 的資料很多,有的使用儲存過程,有的使用游標。本人不喜歡使用游標,我覺得它耗資 效率低 使用儲存過程是個不錯的選擇,因為儲存過程是經過預編譯的,執行效率高,也更靈活。先看看單條 sql 語句的分頁 sql 吧。方法1 適用於 sql server 2000 2005 select t...

手寫分頁sql 分頁查詢SQL語句

表結構 drop table if exists zhoufoxcn userlist create table zhoufoxcn userlist userid int 10 unsigned not null auto increment,username varchar 45 not nul...