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 manage transaction isolation level?
Explain the use of rows option in exp command.
How to create a table interactively?
how to find out largest value in a table
9)When information has to be stored w.r.t employees and their respective departments, which of the following is the Correct formulation of entries? A)Employee and department would together be represented as an entity. B)This is too less information to decide on entities. C)An employee would be one entity and a department would be another. D)Such a scenario cannot be modelled in RDBMS
What is the difference between Delete, Truncate and Drop in Oracle?
Difference between an implicit & an explicit cursor.?
What is a tns file?
SELECT * FROM (SELECT TITLE FROM MOVIE ORDER BY RANK DESC) WHERE ROWNUM > 4; when i run the above query .it produces output as NO ROWS SELECTED.why ?plz any one help me
How do I use unicode codesets with the weblogic jdriver for oracle driver?
How do we know whether an index is created on a table ???
Does facebook use oracle?