Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: strange behaviour (query) ...

Re: strange behaviour (query) ...

From: g.r.s. deisz <g.r.s.deisz_at_ptt-telecom.unisource.nl>
Date: 1997/02/28
Message-ID: <5f63l4$ioe@pwxl01.telecom.ptt.nl>#1/1

>I want to determine the 2nd greatest number. Why does
>
>SELECT MAX(a)
>FROM banane MINUS ( SELECT MAX(a) AS x FROM banane );
>
>not work ? Why are 3 SELECTs necessary ?

The MINUS operator works on two sets:
The first is built by "SELECT MAX(a) FROM banane" and will   contain one number: the maximum value in banane. The second is built by "SELECT MAX(a) AS x FROM banane" and will   also contain one number: the maximum value in banane.

As you see, both sets contain the same value. Subtracting the values in the second set from the values in the first set will leave no records in the first set.

Regards,

Stefan Deisz.


Name      :G.R.S. Deisz
Phone     :+31-50-5855954
E mail    :G.R.S.Deisz_at_PTT-Telecom.Unisource.NL
DISCLAIMER:This statement is not an official statement from, nor
           does it represent an official position of, PTT Telecom BV.
Received on Fri Feb 28 1997 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US