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 an external table?
How can we view last record added to a table?
Can you drop an index associated with a unique or primary key constraint?
What is rowid and rownum in oracle?
nw i'm doing MBA system and planning to do oracle,database management.tell me that whether it is useful r not?.refer any course for my carrier pls
What is E-R diagram ?
2 Answers CGI, Keane India Ltd,
How remove data files before opening a database?
What is a Data Dictionary ?
how to use select statement as formal parameter in procedure specification?(someone said that using string) ex:-procedure(a in number,select ename from emp ) i am asking syntax like this?
SQLERRM is a a. Constraint b. Pre Defined Exception c. Pseduocolumn d. Constant e. None of Above.
What is data type in oracle?
How to login to the server without an instance?