[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pear-dev
Subject:    Re: [PEAR-DEV] [rfc] Row limit support for Pear DB
From:       Graeme Merrall <graeme () inetix ! com ! au>
Date:       2001-10-31 22:24:03
[Download RAW message or body]

Quoting Morgan Christiansson <morgan.christiansson@telia.com>:


> I THINK that oracle has something like this:
> 
> SELECT * WHERE rownum BETWEEN ($from,$to)
> 
> i'm not sure if oracle supports the BETWEEN syntax though but otherwise
> 
> it would be
> 
> SELECT * WHERE rownum <= $from AND rownum >= $to
> 
> Although it was more than a year ago i used oracle, and i didn't use it
> 
> very much. :)
> 

I've been in a discussion on row sets in oracle as well as someone came up with 
this one as well. The main problem was ordering because ROWNUM has precedence 
over ORDER BY. 
I've not tried the solution below using MINUS but I know I've used the 
subselect method plenty of times to emulate LIMIT.

select * from
(select row1, row2,... from table_name order by row1)
where rowno < 31
MINUS
select * from
(select row1, row2,... from table_name order by row1)
where rowno < 20

Cheers,
 Graeme

-- 
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, e-mail: pear-dev-unsubscribe@lists.php.net
For additional commands, e-mail: pear-dev-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic