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 |
What do you understand by database schema and what does it hold?
What are the differences between primary key and unique key?
You have found corruption in a tablespace that contains static tables that are part of a database that is in NOARCHIVE log mode. How would you restore the tablespace without losing new data in the other tablespaces?
How do you store pictures in a database?
Explain an integrity constrains?
How to write an inner join with the where clause in oracle?
What is the difference between translate and replace in oracle?
How can return max date row A b c d e 1 2 1-mar-09 5 10 1 2 10-mar-09 5 10 Only using oracle predefined function. Not user defined. Output:-- A b c d e 1 2 10-mar-09 5 10
How to bring a tablespace online?
i deleted 4 records form the table.after i have applied commit .now i want to get back those records.how?
From the database level, how can you tell under which time zone a database is operating?
Explain coalesce function?