时间:2021-07-01 10:21:17 帮助过:20人阅读
Oracle:
--这样的分页查询方式不不过针对单表的简单查询,对于最内层查询是复杂的
--多表联合查询或最内层查询包括排序的情况一样有效
SELECT?*?FROM?(?
SELECT?ROWNUM?RN?,?T.*??FROM?
(SELECT?*?FROM?FTNEMR.PATIENT_VISIT)?T?WHERE?ROWNUM?<=?40?)?
WHERE?RN?>=?21
ORDER?BY?PATIENT_ID;
--这样的方式比上面的方式要性能要低非常多
SELECT?*?FROM?(?
SELECT?ROWNUM?RN,?T.*?FROM?
(SELECT?*?FROM?FTNEMR.PATIENT_VISIT)?T?)?
WHERE?RN?BETWEEN?21?AND?40?
ORDER?BY?PATIENT_ID
SQL?Server:
--查询出第21条至第30条数据?--
SELECT?TOP?10?*?FROM?dbo.HIS_BA1???
WHERE?FID?NOT?IN(SELECT?TOP?20?FID?FROM?dbo.HIS_BA1?ORDER?BY?FID)
Mysql:
SELECT?*?FROM?table?LIMIT?5,10;?//?检索记录行?6-15
数据库分页查询
标签:str uri data- between oracl rgb sele limit 4.6