--------------------------ORACLE数据库分页SQL举例------------------------------------------------
SELECT *
FROM (
SELECT TEMP.*, ROWNUM AS NUM
FROM (
SELECT EB.EHR_ID,EB.PERSON_NAME,CL.SVC_ID a,BILL.SVC_ID b,BILL.ITEM_NAME
FROM PHIS.EHR_BASE EB, PHIS.SVC_CLINIC CL,PHIS.SVC_CLINIC_BILL BILL
WHERE EB.EHR_ID = CL.EHR_ID
AND CL.SVC_ID = BILL.SVC_ID
) TEMP
)
WHERE NUM <= 5
AND NUM > 0
--------------------------DB2数据库分页SQL举例---------------------------------------------------
SELECT *
FROM (
SELECT TEMP.*, ROW_NUMBER() OVER() AS NUM
FROM (
SELECT EB.EHR_ID,EB.PERSON_NAME,CL.SVC_ID a,BILL.SVC_ID b,BILL.ITEM_NAME
FROM PHIS.EHR_BASE EB, PHIS.SVC_CLINIC CL,PHIS.SVC_CLINIC_BILL BILL
WHERE EB.EHR_ID = CL.EHR_ID
AND CL.SVC_ID = BILL.SVC_ID
) TEMP
)
WHERE NUM <= 5
AND NUM > 0
-------------------------------------------------------------------------------------------------