Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: discarding first and last element from an ordered set of values
On Mon, 20 Feb 2006 15:14:33 +0100, Cris Carampa wrote:
> But how can I discard the last element, giving that I don't know in
> advance how many rows will be returned by the query?
>
> Thank you. Kind regards,
This is not so hard:
select a.ename,a.job from
( select ename,job,
row_number() over (order by empno) as rown
from emp
order by rown) a,
(select count(*) as cnt from emp) b
where a.rown > 1 and
a.rown < b.cnt
/
-- http://www.mgogala.comReceived on Mon Feb 20 2006 - 11:57:28 CST