If I have a select statment which retrives 2 rows, & that
rows have the same data in all the fields except the last
field and I want to merge the 2 rows to be in 1 row with
concatenating the last field which have the different
data.... eg: the 1st row has these fields: A-B-C
the second row has: A-B-X ........ i want to merge the two
row to be in one row like ----> A- B- C,X

Answer Posted / murali mohan

Try this...Hope this will give the Required Answer
create table testsamp(a char,b char,c char);
insert into testsamp values ('A','B','C');
insert into testsamp values ('A','B','X');

select a,b,c from(
select a , b,
c||lead(c,1) over (partition by a,b order by a,b) c from
testsamp ) tmp where rownum=1;

Regards,
Murali

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we use oracle pl/sql block in core java? if so how? pls get back to me .....

2507


Is insert autocommit in oracle?

606


How to assign query results to variables?

594


how to join query for one source type is oracle another source type is sql server ?

1993


Explain the use of rows option in exp command.

585






What is open database communication (odbc) in oracle?

548


How to insert a new row into a table in oracle?

593


What is ADDM Advisor in Oracle?

665


What is the scope of a local variable?

585


Can the query output be sorted by multiple columns in oracle?

574


How can I get column names from a table in oracle?

538


How to define a variable of a specific record type?

614


Explain about integrity constraint?

606


For a field in a repeating frame, can the source come from the column which does not exist in the data group which forms the base for the frame ?

1558


Please explain oracle left join with an example?

587