Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> How do I return N results per page + total number of results

How do I return N results per page + total number of results

From: BoulderDavid <dbenson_at_alt.net>
Date: Thu, 13 Jan 2000 10:27:26 -0800
Message-ID: <2a1814d4.2dad613d@usw-ex0102-011.remarq.com>


I'm able to return search results w/ N results per page. What I'd like to be able to add is text similar to: Showing results 20-29 of 125 results. How can I return the total number for results w/o executing the query twice?

Here's my current query:
select * from (
  select rownum rn, Q.* from (
    select id, type, name

      from mytbl
     where content (name, '$<search_key>') > 0
     order by type, name

  ) Q)
where rn between 20 and 29

I've tried adding max, count functions at various points in the query, but they won't work since they are group functions and I'm attempting to combine them w/ multiple rows.

Thanks,

David

Received on Thu Jan 13 2000 - 12:27:26 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US