用一句SQL取出第 m 條到第 n 條記錄的方法

2021-04-12 18:52:09 字數 1080 閱讀 6698

1

--從table 表中取出第 m 條到第 n 條的記錄:(not in 版本)23

select

topn-m

+1*4

from

table

5where

(id 

notin

(select

topm-1

id from

table

))  67

8--從table表中取出第m到n條記錄 (exists版本)910

select

topn-m

+1*from

table

asa 

where

notexists11(

select

*from

(select

topm-1

*from

table

order

byid) b 

where

b.id

=a.id ) 

12order

byid

1314

15--

m為上標,n為下標,例如取出第8到12條記錄,m=8,n=12,table為表名

用一句SQL取出第 m 條到第 n 條記錄的方法

windows平台下程式日誌的設計和實現 上 設計 實現和應用 問題 在很多應用中,需要記錄程式執行過程中的關鍵資訊 關鍵操作 警告和異常等。這些資訊可以被用來追溯 除錯和排錯 分析執行時環境,或者用於其他特定的用途。一些長期執行的 無人監控的或者執行在後台不帶ui的程式,記錄執行時的日誌尤其重要。...

SQL Oracle取出第m條到第n條記錄的方法

sql oracle取出第m條到第n條記錄的方法 用一句sql取出第 m 條到第 n 條記錄的方法 從table 表中取出第 m 條到第 n 條的記錄 not in 版本 select top n m 1 from table where id not in select top m 1 id fr...

SQL取出第 m 條到第 n 條記錄的方法

從table 表中取出第 m 條到第 n 條的記錄 not in 版本 select top n m 1 from table where id not in select top m 1 id from table 從table表中取出第m到n條記錄 exists版本 select top n m...