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: Merge lines to get rid of nullvalues?

Re: Merge lines to get rid of nullvalues?

From: programmer <int.consultNOCAPITALS_at_macmail.com>
Date: Mon, 28 Jul 2003 16:24:45 +0100
Message-ID: <bg3fn4$ss5$1@pheidippides.axion.bt.co.uk>


> A B C
> Key1 "text1" null
> Key1 null 7
> Key2 "text2" null
> Key2 null 3
> Key3 null 9
> Key4 "text4" null
> Key4 null 79

>
> B is a CHAR column and C is a NUM
>
> I want to merge the rows with the same key and put the values in the
> null-fields, like this:
>
> A B C
> Key1 "text1" 7
> Key2 "text2" 3
> Key3 null 9
> Key4 "text4"79
>
> As you can see, it is not always 2 keys, so some fields might still be
> null.
>

Something like this (not tested) should do most of the work. You just have to map chr(255) and 2000000000 to null.

select A, min(BV), min(CV)
from
(
select A, nvl(B, chr(255)) BV, nvl(C,2000000000) CV from table1
) Received on Mon Jul 28 2003 - 10:24:45 CDT

Original text of this message

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