Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL question
I have one posible form to resolve the problem
select Col_A, Col_B, decode( Col_A, Col_B, 1, 0) Col_Different_Or_Not
the only problem is that in this moment I can`t think how manage then NULL values, but if is not important for you, the select would work with no problem.
Any question emailme to
lsanhuez_at_udec.cl
Leonel Sanhueza
Universidad de Concepcion
Chile.
hsiwei yu <yu.michael_at_epamail.epa.gov> escribió en artículo
<6juomj$lkc1_at_valley.rtpnc.epa.gov>...
> Hi,
>
> a newbie question:
>
> have a table with two columns
> Col_A Col_B
> ==============
> vv yyy
> qq qq
> zz zz
>
> How to create an additional column
> Col_A Col_B Different_A_B_Or_Not
> =================================
> vv yyy 1
> qq qq 0
> zz zz 0
>
> Here's what I have tried (& won't work)
> select Col_A, Col_B
> , decode(( Col_A != Col_B )
> , 0, 0
> , 1, 1
> , NULL ) as Col_Different_Or_Not
> from ...
>
> Need your help, thanks,
>
> Michael
>
>
>
Received on Mon May 25 1998 - 22:45:47 CDT
![]() |
![]() |