.  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 the PL/SQL Statements used in cursor processing ?

4 Answers  


Can we call a function containing dml statements in a select query?

0 Answers  


need to split a string into separate values. eg. col1 col2 ---------- 100 - 'a,b,c' 200 - 'a,x,d,e' 300 - 'c' result: value count ------------- a - 2 b - 1 c - 2 etc.

2 Answers  


What are different types of tables in sql?

0 Answers  


What is embedded sql what are its advantages?

0 Answers  






how to get @@error and @@rowcount at the same time? : Sql dba

0 Answers  


write a query to display diference between two dates in sql server

2 Answers  


What is the difference between jpql and sql?

0 Answers  


how can we transpose a table using sql (changing rows to column or vice-versa) ? : Sql dba

0 Answers  


will function return more than one value how

9 Answers   Accenture,


What is varchar example?

0 Answers  


What is your daily office routine?

0 Answers   Data Vision,


Categories