Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: how to get the higher value?
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 )
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
![]() |
![]() |