DB:
DB分页查询
SELECT * FROM (Select 字段字段字段rownumber() over(ORDER BY 排序用的列名 ASC) AS rn from 表名) AS a WHERE arn BETWEEN AND
以上表示提取第到的纪录
select * from (select rownumber() over(order by id asc ) as rowid from table where rowid <=endIndex ) where rowid > startIndex
如果Order By 的字段有重复的值那一定要把此字段放到 over()中
select * from ( select ROW_NUMBER() OVER(ORDER BY DOC_UUID DESC) AS ROWNUM DOC_UUID DOC_DISPATCHORG DOC_SIGNER DOC_TITLE from DT_DOCUMENT ) a where ROWNUM > and ROWNUM <=
增加行号不排序
select * from ( select ROW_NUMBER() OVER() AS ROWNUMt* from DT_DOCUMENT t ) a
增加行号按某列排序
select * from ( select ROW_NUMBER() OVER( ORDER BY DOC_UUID DESC ) AS ROWNUMt* from DT_DOCUMENT t ) a
Mysql:
最简单
select * from table limit startpageNum
比如从取个数据
select * from table limit
Oracle
select * from (select rownumname from table where rownum <=endIndex ) where rownum > startIndex
例如从表Sys_option(主键为sys_id)中从条记录还是检索条记录语句如下
SELECT *
FROM (SELECT ROWNUM Rt* From Sys_option where rownum < ) t
Where tR >=
sql server:
例如从表Sys_option(主键为sys_id)中从条记录还是检索条记录语句如下
SELECT *
FROM (SELECT ROWNUM Rt* From Sys_option where rownum < ) t
Where tR >=