Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: sql
What? You want performance, too? <g>
I was a bit quick with the send button. How about
select max(c) from t where c < (select max(c) from t)
What effect would a descending index on c make? Can the database resolve the outer max without totally enumerating all the values of c less than the inner max? Does the explain plan prove or disprove this? Or do you have to infer it from TKPROF IO counts?
"Daniel Morgan" <dmorgan_at_exesolutions.com> wrote in message
news:3D908DB2.A32D71FA_at_exesolutions.com...
> Brian E Dick wrote:
>
> > select max(c) from (select c from t where c < (select max(c) from t))
> >
> > "abhishek" <singhhome_at_yahoo.com> wrote in message
> > news:e52380ab.0209232324.24bd2cbd_at_posting.google.com...
> > > how to write sql querry to
> > > 1. show the second maximum value of a column.
>
> Fascinating. I like it.
>
> Now to explain plan them all.
>
> Thanks everyone for the material. My students, in a few weeks, will thank
> you too. (I think)
>
> Daniel Morgan
>
Received on Tue Sep 24 2002 - 14:33:29 CDT
![]() |
![]() |