how can get like this result
table A
col1 col2
--- -----
a A
b B
C C
.. ..
.. ...
.. ...
wants result like for a single column
col1
------
a,b,c,........n of data
and
another is
col1
-------
A B C D ........
a b b d ........
Answers were Sorted based on User's Feedback
Answer / ajit
select wm_concat(col1) col1
from t1;
select wm_concat(col2)||chr(10)||
wm_concat(col1) col1
from t1;
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / suman rana
If you are using Oracle 11g Release 1 and above version,
following queries will work.
SELECT listagg (b, ',') WITHIN GROUP (ORDER BY 1) hh
FROM (SELECT 'A' a, 'a' b FROM DUAL
UNION
SELECT 'B', 'b' FROM DUAL
UNION
SELECT 'C', 'c' FROM DUAL);
WITH qry AS
(SELECT 'A' a, 'a' b FROM DUAL
UNION
SELECT 'B', 'b' FROM DUAL
UNION
SELECT 'C', 'c' FROM DUAL)
SELECT listagg (a, ' ') WITHIN GROUP (ORDER BY 1) FROM qry
UNION ALL
SELECT listagg (b, ' ') WITHIN GROUP (ORDER BY 1) FROM qry;
| Is This Answer Correct ? | 1 Yes | 1 No |
How to create a table interactively?
What is a parameter file in oracle?
How to login to the server without an instance?
Name the three major set of files on disk that compose a database in Oracle?
How do I find the database name in oracle?
Can you drop an index associated with a unique or primary key constraint?
2. Display the item number and total cost for each order line (total cost = no of items X item cost). Name the calculated column TOTAL COST.
How to estimate disk space needed for an export job?
acname actype amount ac1 credit 300 ac2 credit 4000 ac1 debit 4000 ac2 debit 455 ac1 credit 500 how to get sum of credit and sum of debit for each account
What are advantages of dateset in datastage?
What happens if the imported table already exists?
What is difference between SUBSTR and INSTR?