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: AVG across columns

Re: AVG across columns

From: Geoff Muldoon <geoff.muldoon_at_trap.gmail.com>
Date: Tue, 7 Aug 2007 09:50:27 +1000
Message-ID: <MPG.21225ed29081e515989997@news.readfreenews.net>


I said ...
> Tim B says...
>> how about something like this, using nvl and nvl2?
>> (not tested):
>> select
>> row_id,
>> nvl(v1, 0) valv1,
>> nvl2(v1, 1, 0) countv1,
>> nvl(v2, 0) valv2,
>> nvl2(v2, 1, 0) countv2 ,
>> (valv1 + valv2)/(countv1 + countv2) ... etc.
>
> Tested using small sample and yes, it works. Totally overlooked NVL2.
>
> Thanks heaps!
>
> Now trying with real data ...

.. and sucessful there too. Geoff M owes Tim B one big time.

GM Received on Mon Aug 06 2007 - 18:50:27 CDT

Original text of this message

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