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 IS THE DEFINITION OF DEFAULT CUSTOMER IN AR?

1784


what is the use of system.effective.date variable in oracle?

758


What are the benefits of ordbms?

709


What are the restrictions on external table columns?

625


How to drop an index in oracle?

703






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

686


What are the uses of linked server and explain it in detail?

672


What is the cache hit ratio, what impact does it have on performance of an Oracle database and what is involved in tuning it?

1695


What are ddl statements in oracle?

671


How to create a table index in oracle?

743


How can I introduce multiple conditions in like operator?

628


Explain what are the different type of segments?

660


What are the execution control statements?

708


How to export data with a field delimiter?

662


How to start a specific oracle instance?

681