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 -> Is it possible to subtract case statements

Is it possible to subtract case statements

From: MrHelpMe <clinttoris_at_hotmail.com>
Date: 14 Feb 2007 07:30:25 -0800
Message-ID: <1171467024.944997.209170@a75g2000cwd.googlegroups.com>


Hello all,

I am wondering if it is possible to subtract case statements in oracle 9.2? If it is, could someone please show me how. This is basically what I am using for my case statements:

[code]

SELECT
(Case when field1 = 'hello' then 1 else 0 END)Case1,
(case when field2='test' then 1 else 0 END)Case2,
FROM Table x;

[/code]

So I would get the resultset as such:

Case1  Case2       Result
1            1               0
0            0               0
1            0               0
0            1              -1

Any ideas. Thanks so much Received on Wed Feb 14 2007 - 09:30:25 CST

Original text of this message

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