Oracle中查詢第N到M條記錄

2021-08-31 16:44:15 字數 468 閱讀 3379

select *

from (select rownum rn , t.* from table table t)

where rn between n and m

[注:] rownum 必須重新命名為rn或者是其他的乙個虛擬名字

------------------------以下是更新第n到m條的記錄時所需要注意的問題----------------------------

update table t set t.price='88'

where t.code in ( select t.code

from ( select rownum rn , t1.* from table t where t1) t

where rn between n and m )

[注:] price 是該錶要更新的欄位名, code是該錶的唯一標識字段

oracle會自動排序.

SQL Server 2000查詢n到m條記錄

sql server 2000查詢n到m條記錄?1 select top m from tablename where id not in select top n id from tablename 2 select top m into 臨時表 或表變數 from tablename order...

SQL Server 2000查詢n到m條記錄

sql server 2000查詢n到m條記錄?1 select top m from tablename where id not in select top n id from tablename 2 select top m into 臨時表 或表變數 from tablename order...

SQL Server 2000查詢n到m條記錄

sql server 2000查詢n到m條記錄?1 select top m from tablename where id not in select top n id from tablename 2 select top m into 臨時表 或表變數 from tablename order...