Select * from (select Table. *, Row_Number () over (Order By Field) RK from Table) Where rk> = 10 and rK <= 20 =================== =========================== r_number function description: Return to the offset of a row in the ordered group, so that can be used in specific standards Line number. Sample: The following example returns each employee again in each department to sort the sequence number after the employee number
SELECT Department_ID, Last_Name, Employee_ID, Row_Number () over (partition by department_id order by Employee_ID) AS EMP_ID from Employeeswhere Department_ID <50;
Department_id last_name Employee_id Emp_ID ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --- ---------- 10 Whalen 200 1 20 Hartstein 201 20 Fay 202 2 30 Raphaly 114 1 30 Khoo 115 2 30 Baida 116 3 30 Tobias 117 4 30 Himuro 118 5 ===== =====================================================================================================================================================================================38387