Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Subtracting from a set of rows/columns
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
![]() |
![]() |