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: SQL question - find rows surrounding criteria

Re: SQL question - find rows surrounding criteria

From: Jay <me_at_heyjay.com>
Date: Wed, 21 Jul 2004 22:57:01 -0500
Message-ID: <O_adnWnvTIxApmLdRVn-pQ@speakeasy.net>


>
> You can do this:
>
> --
> select id,tms,price from (
> select id, tms, price,
> row_number() over (order by case when delta >=0 then delta end)
rn1,
> row_number() over (order by case when delta <=0 then -delta end) rn2
> from (select id, tms, price, tms - to_date('1/2/04 18:00:00', 'mm/dd/yy
> hh24:mi:ss') delta from quote)
> ) where rn1=1 or rn2=1
>

Thanks VC, I'll have to look up the "over" clause

Jay Received on Wed Jul 21 2004 - 22:57:01 CDT

Original text of this message

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