Subject | Re: Highest and Second highest values |
---|---|
Author | Adam |
Post date | 2006-03-24T03:43:47Z |
--- In firebird-support@yahoogroups.com, David Johnson
<johnson_d@...> wrote:
achieve the same thing. Others have the keyword limit to do the same
thing.
If you are a sadist, You may even be able to use union and a pretty
terrible looking query to do it with plain vanilla.
Adam
<johnson_d@...> wrote:
>Firebird SQL
> I take that back ... vanilla SQL doesn't handle that well.
> supports the FIRST predicate, so I'm barking up a tree.FB 2 and some other DBs also support the ROWS syntax which could
achieve the same thing. Others have the keyword limit to do the same
thing.
If you are a sadist, You may even be able to use union and a pretty
terrible looking query to do it with plain vanilla.
Adam
>table
> On Fri, 2006-03-24 at 03:11 +0000, Adam wrote:
> > > Is it possible to select both the max and next max value in a
> > using
> > > dsql? Ie the 2 highest values in a tables column.
> >
> > Easy.
> >
> > select first 2 *
> > from mytable
> > order by myvalue desc
> >
> > A descending index on myvalue is useful if the table is large.
> >
> >
> > Adam
>