Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> how to do this with sql?

how to do this with sql?

From: hopehope_123 <hopehope_123_at_yahoo.com>
Date: 10 May 2006 07:40:51 -0700
Message-ID: <1147272051.477285.314240@u72g2000cwu.googlegroups.com>


Hi ,

I have to do the following :

table_a has set of records based on the entry date:

(entry_date,name,surname,customer_id) :

20060510,null,yy,1
20060509,xx,null,1

What i need is to combine these two rows into 1 , the final record will be:

xx,yy,1 ( entry_date is not needed in final record) .

The rule for each column is : get the first non-null value which is entered last.

How can i do this? I tried some analytic functions but could not succeed.

By using seperate sql statements i can do the following:

SELECT name

	 FROM table_a
                   where name is not null and entry_date =

(select max(entry_date)
from table_a where name is not null) SELECT surname FROM table_a where surname is not null and entry_date =
(select max(entry_date)
from table_a where surname is not null) Is it possible to do this in a single sql statement?

Kind Regards,
tolga Received on Wed May 10 2006 - 09:40:51 CDT

Original text of this message

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