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

What are the built-in functions used for sending Parameters to forms ?

2835


Please explain oracle left join with an example?

575


How to export data to a csv file?

612


What is data block in Oracle?

611


How do I find the database name in oracle?

593






What is transaction control statement and how many types of transaction control statement in Oracle?

558


How to rename a tablespace in oracle?

607


How to create a new view in oracle?

600


What is hash cluster in oracle?

588


What is a read write transaction in oracle?

590


What is the relation of a user account and a schema in oracle?

577


Explain the use of indexes option in imp command.

557


What is a schema in oracle?

530


How to define an anonymous block?

610


How to convert characters to times in oracle?

586