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 -> Re: discarding first and last element from an ordered set of values

Re: discarding first and last element from an ordered set of values

From: Mladen Gogala <gogala_at_sbcglobal.net>
Date: Mon, 20 Feb 2006 17:57:28 GMT
Message-Id: <pan.2006.02.20.17.56.16.599919@sbcglobal.net>


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.com
Received on Mon Feb 20 2006 - 11:57:28 CST

Original text of this message

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