Path: news.f.de.plusline.net!news-fra1.dfn.de!npeer.de.kpn-eurorings.net!npeer1.kpn.DE!ecngs!feeder.ecngs.de!news.germany.com!postnews.google.com!y5g2000hsa.googlegroups.com!not-for-mail
From: hasta_l3@hotmail.com
Newsgroups: comp.databases.oracle.server
Subject: Re: getting the nearest number from a column
Date: 11 Apr 2007 00:04:45 -0700
Organization: http://groups.google.com
Lines: 40
Message-ID: <1176275085.869899.226850@y5g2000hsa.googlegroups.com>
References: <1176105010.255201.64370@l77g2000hsb.googlegroups.com>
   <pan.2007.04.09.12.49.42@verizon.net>
   <1176187120.140961.40540@b75g2000hsg.googlegroups.com>
   <pan.2007.04.10.12.23.34@verizon.net>
   <1176220566.397481.142550@w1g2000hsg.googlegroups.com>
   <pan.2007.04.10.16.35.13@verizon.net>
   <1176225940.917619.99100@n76g2000hsh.googlegroups.com>
   <pan.2007.04.10.17.40.43@verizon.net>
   <1176233679.927610.259310@v33g2000cwv.googlegroups.com>
   <pan.2007.04.10.20.52.39@verizon.net>
NNTP-Posting-Host: 85.234.196.40
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1176275086 334 127.0.0.1 (11 Apr 2007 07:04:46 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 11 Apr 2007 07:04:46 +0000 (UTC)
In-Reply-To: <pan.2007.04.10.20.52.39@verizon.net>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.0.11) Gecko/20070312 Firefox/1.5.0.11,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: y5g2000hsa.googlegroups.com; posting-host=85.234.196.40;
   posting-account=IKOHxgwAAADFMMZsoxvSQipqOS6S45qr
Xref: news.f.de.plusline.net comp.databases.oracle.server:196165

On 10 avr, 22:56, Mladen Gogala <mgogala.SPAM-ME....@verizon.net>
wrote:
> On Tue, 10 Apr 2007 12:34:40 -0700, hasta_l3 wrote:
> > Mladen, I agree that one may be surprised by the behavior of MIN, and I
> > agree that the documentation could be improved, to say the least.
>
> > However, I do not agree that there is a documentation bug stricto sensu,
> > for
> > the reference of MIN explicitly requests to look at "Analytic Functions"
> > for
> > semantic, which in turns requests to look at the database warehouse
> > guide.
>
> Raul, I must say it again: that is only my opinion. While the
> row_number() and rank() tricks will work for the MIN function, they
> will not work for the max() function. To do that, you will have
> to order by desc.
>

I'm afraid I dont understand you fully here, Mladen...

One could compute the salary(ies) farthest away
from a target with :

    select distinct sal from
    (
        select sal, rank() over (order by abs(sal - 2900) desc) rnk
        from emp
    )
    where rnk <= 1;

Would you have an example illustrating the problem you
had in mind ?

Cheers

--- Raoul



