locked
Get Total Count of record with pagging in Oracle RRS feed

  • Question

  • User64117442 posted

    Hi,

    I am using this query to implement pagging from database

    SELECT * FROM (SELECT  LOCATION.*,row_number() over (order by ID) rn FROM LOCATION) RN WHERE rn BETWEEN 1 AND 10

    this query returing top 10 records from table and total count of record in this table is 16.

    can i get total count of table in single query ?

     

    Thanks in Advance

    Pratik Asthana

     

    Wednesday, February 1, 2012 6:41 AM

Answers

  • User64117442 posted

    got my answer :-) using count(*) over()

     

    SELECT * FROM (SELECT  LOCATION.*,row_number() over (order by ID) rn, count(*) over() FROM LOCATION) RN WHERE rn BETWEEN 1 AND 10

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 1, 2012 6:57 AM