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
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / sreeharibabu g
select max(a),max(b),listagg(c,',') within group ( order by null) from testsamp group by a,b;
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the difference between a vector and an Array? (Java)
what is the difference between dbms and rdbms?
how table is defined in plsql table? how can i select column from plsql table? can i use select * from plsql table type?
There is a big table with "n" of rows and 40 + columns .It doesn't have primary key.How do you select the primary key. In other words how do you get the duplicate records.
write a query to count number of alphabets in given string for example "APPLE" write a query to generate sequence from 50 to 100 write a query to display in single string "ABCD,EFGH,IJKL,PQRS"
WHT ARE THE AGGREATE FUNCTIONS?
What is the relation of a user account and a schema?
What are the various oracle database objects?
What is the usage of control file in oracle?
Can we convert a date to char in oracle and if so, what would be the syntax?
Explain overloading. Can functions be overloaded?
Explain the use of show option in imp command.