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: Need Help with SQL - Repost

Re: Need Help with SQL - Repost

From: <vietmv_at_my-deja.com>
Date: Thu, 11 Jan 2001 22:58:34 GMT
Message-ID: <93ldqm$k4$1@nnrp1.deja.com>

you can use the builtin function 'decode', which allows you to do if- -else within a sql statement. look up the manual for how to use this function.

cheers

In article <t5sc80i5ljdleb_at_corp.supernews.com>,   "Anna Henson" <anna_henson_at_yahoo.com> wrote:
> Hello Oracle Users,
>
> I would like to write a query similar to the one below, but Oracle
 does not
> accept 'IF' statement. Is there anyother way to
> write a query similar to the one below.
>
> select a.score , (If b.score in (11,12,13) then InActive=1),
> (If b.score NOT in (11,12,13) then Active=1), sum(b.Balance)
>
> from OldTable a, NewTable b
> group by a.score;
>
> Thanks,
>
> Anna Henson
>
>

--
Viet Hoang
vietmv_at_my-deja.com


Sent via Deja.com
http://www.deja.com/
Received on Thu Jan 11 2001 - 16:58:34 CST

Original text of this message

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