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: Subtracting from a set of rows/columns

Re: Subtracting from a set of rows/columns

From: Martin T. <bilbothebagginsbab5_at_freenet.de>
Date: 14 Mar 2007 04:37:45 -0700
Message-ID: <1173872265.831571.282300@e1g2000hsg.googlegroups.com>


On Mar 14, 10:14 am, jan.stulraj..._at_zoznam.sk wrote:
> SELECT
> CASE WHEN sort_number <>0 THEN COUNT(col1) END COUNT1,
> CASE WHEN sort_number <>0 THEN COUNT(col2) END COUNT2,
> CASE WHEN sort_number <>0 THEN COUNT(col3) END COUNT3,
> CASE WHEN sort_number <>0 THEN COUNT(col4) END COUNT4,
> CASE WHEN sort_number <>0 THEN COUNT(col5) END COUNT5
> FROM test_counters
> WHERE test_id=:p_test_id;
>
> It will not Count the rows with NULL in col1, col2 etc...
>
> Jan
>

Oh I'm sorry I really should have been more precise. The COUNT# columns do contain arbitrary (increasing) counter values. So It may initially look like
SORT_NUMBER | COUNT1

0 | 0
1 | 3
2 | 7
3 | 7
4 | 7
5 | 23

...

I should've used another name than COUNTx ::)

br,
Martin Received on Wed Mar 14 2007 - 06:37:45 CDT

Original text of this message

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