Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Optimizing SELECT Query
Daniel Morgan <dmorgan_at_exesolutions.com> wrote in
news:3D246E8C.3C0880D6_at_exesolutions.com:
> Carsten Grammes wrote:
>
>> Hello world, >> >> following situation: I have a table T with a column C (C are >> numbers). I want to find the number which is smaller but nearest to a >> given value N. >> >> How to formulate this as a select statement in an efficient way? >> >> Thanks, >> Carsten. >> >> --- >> I want to die peacefully in sleep like my grandfather. >> Not screaming in terror like his passengers!
Replace N with the value entered:
select max(C) from T where N-C > 0;
Any better ways out there?
-- Jason Baugher Virtual Adept Professional Consulting Services 1406 Adams St. Quincy, IL 62301 (217) 221-5406 http://baugher.pike.il.us/virtualadept jason_at_baugher.pike.il.usReceived on Thu Jul 04 2002 - 12:08:12 CDT
![]() |
![]() |