Retrieve total rows over paging

  • Hi everybody,

    When I use ROW_NUMBER for making paging I would like to have also the total of rows that I would have without use of ROW_NUMBER.

    Currently I run a query a second time without ROW_NUMBER with the same filter of the previous query to retrieve this value. There is a better way to obtain the same result?

    Thanks.

  • I am sure this is not what you are looking for,

    Select * , Row_number() OVER (order by C),

    (Select count(*) FRom T)

    from T

    post the query in this format and you would get lot better replies,

    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    ---------------------------------------------------------------------------------

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply