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

Home -> Community -> Usenet -> c.d.o.misc -> Re: how to get the higher value?

Re: how to get the higher value?

From: <mjp_ttc_at_my-deja.com>
Date: Tue, 14 Mar 2000 23:25:22 GMT
Message-ID: <8amhot$g4j$1@nnrp1.deja.com>


You may try something like this,
replacing ValueX and valueY by your variables: Select

      Decode(
             to_char(sign(valueX - valueY),'S9'),
             '+1', ValueX -- Value X es greater
             '+0', ValueX -- X equals to Value Y
             '-1', ValueY -- Y is greater
            )

from my tab;

In article <8aliih$ove$1_at_nnrp1.deja.com>, mitch23_at_hotmail.com wrote:
> I need to to compare the numeric values in two separate select
> statements and get the higher number...Is there a way to do this in
> pure SQL? I can't use PL/SQL as this must be run with Crystal Reports.
>
> Thanks in advance.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Tue Mar 14 2000 - 17:25:22 CST

Original text of this message

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