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
When do we use group by clause in a sql query?
Explain what are the uses of rollback segment?
1) What is ONE_SIZE_FITS_ALL approach? 2) Explain the Common & Variable Header of DATA FILE? 3) What are the Drawbacks to using OMF DB? and the Advantages? 4) List out the Advantages of Undo T.spaces over the Undo SEGMENT? 5) Difference between the Temporary tablespace with TEMPFILE and the Tablespace with TEMPORARY Keyword? 6) What are the situation extents are freeing for reuse.
How to pass parameters to procedures?
Write a trigger example in oracle?
What are the limitations of check constraint?
How to assign a table row to a record variable?
Is there an oracle sql query that aggregates multiple rows into one row?
What are triggers in oracle?
How to bring a tablespace online?
What are the advantages of oracle?
How to load data from external tables to regular tables?
How do I limit the number of oracle database connections generated by weblogic server?
What is oracle in java?
What do you understand by a database object?