.  have a tablle like this: cust acc ----------- a 1 b 2 b 3 c 4 c 5 c 6 I Want below o/p: cust acc --------------- a 1 b 2|3 c 4|5|6 Please any one can you have any ideas share me. I have urgent requirement.
CUST         ACC
a            dv
b            fg
b            bh
c            mk
c            cl
c            so
result:-
A  B   c
dv fg mk
   bh cl
      so

Answers were Sorted based on User's Feedback



.  have a tablle like this: cust acc ----------- a 1 b 2 b 3 c 4 c 5 c 6 I Want below o/p: cust..

Answer / phanikumar kode

select cust,listagg(acc,' ') within group(order by acc) from  tbl group by cust;

Is This Answer Correct ?    2 Yes 0 No

.  have a tablle like this: cust acc ----------- a 1 b 2 b 3 c 4 c 5 c 6 I Want below o/p: cust..

Answer / barun

select decode(cust,'a',acc) as A ,decode(cust,'b',acc) as B,decode(cust,'c',acc) AS C from customer

Is This Answer Correct ?    1 Yes 0 No

.  have a tablle like this: cust acc ----------- a 1 b 2 b 3 c 4 c 5 c 6 I Want below o/p: cust..

Answer / ramaraju

select cust,listagg(acc,'|') within group(order by acc) from t2 group by cust;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

What are triggers in sql?

0 Answers  


What is trigger explain it?

0 Answers  


How delete all records from table in sql?

0 Answers  


Is it mandatory for the primary key to be given a value when a new record is inserted?

0 Answers  


What is CYCLE/NO CYCLE in a Sequence?

2 Answers  






What are different types of sql commands?

0 Answers  


What is trigger and types?

0 Answers  


Is sql dba a good career? : SQL DBA

0 Answers  


what is a cursor

9 Answers   IBM, TCS, Wipro,


Is natural join same as inner join?

0 Answers  


What are % TYPE and % ROWTYPE ? What are the advantages of using these over datatypes?

4 Answers  


Which one is faster ienumerable or iqueryable?

0 Answers  


Categories