Bill,

Try to find a copy of 'SQL for Smarties' by Joe Celko.

Chapter 25 Subsets has example code for the Top N values which I have
successfully used in the past to get Next N as well.

The final iteration of the code to display top three salaries (taken
from the book) is :-

select distinct count(*), a.salary
from employees as a, employees as b
where (a.salary <= b.salary)
group by a.salary
having count(*) <=3;

(I did have to translate the SQL into the local version :-^)

In general what is being done is find the number of rows 'less than' the
target row and use that to order and then select the required target
rows.

Hope that makes sense.


--Mark Thornber

Bill OConnor wrote:
> 
> I can do this easily with MySQL but doing it with
> Oracle has not been that obvious to me.  I want to use
> a subset of the selected rows on a webpage.  For
> instance if the query returns 100 rows I want show
> just 10 of them on the page, 11-20 on the next etc.
> Is it possible to specify the range of rows returned
> from the select as part of the select statement?
> 
> I think I said that right.
> 
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/

Reply via email to