Re: how can i find out the second maximum value from a table by sql

From: Pablo Sanchez <pablo_at_dev.null>
Date: Fri, 15 Feb 2002 00:24:36 -0700
Message-ID: <VI2b8.147$FG2.395386_at_news.uswest.net>


"Ken Papai" <ken_at_kenpapai.com> wrote in message news:BRVa8.13713$kt5.29586_at_rwcrnsc52.ops.asp.att.net...
>
> "keith" <prk25_at_yahoo.com> wrote ...
> > sohelcsc_at_yahoo.com (Leader) asked:
> > > How can i find out the second maximum value from a table by sql
> > >
> > > thanks
> > > Hoque
 

> > select max(col) from table where col != (select max(col)
 from
> table);
>
> PERFECT and best answer by Keith.

Wondering aloud, would the outer 'select' result in a table scan?

--
Pablo Sanchez, High-Performance Database Engineering
www.hpdbe.com
Available for short-term and long-term contracts
Received on Fri Feb 15 2002 - 08:24:36 CET

Original text of this message