我在表格中有这样的数据
I have data like this in a table
NAME PRICE
A 2
B 3
C 5
D 9
E 5
我想在一行中显示所有值;例如:
I want to display all the values in one row; for instance:
A,2|B,3|C,5|D,9|E,5|
在 Oracle 中,我将如何进行查询以提供这样的字符串?我不需要它被编程成什么东西;我只是想要一种方法让该行出现在结果中,以便我可以将其复制并粘贴到 Word 文档中.
How would I go about making a query that will give me a string like this in Oracle? I don't need it to be programmed into something; I just want a way to get that line to appear in the results so I can copy it over and paste it in a word document.
我的 Oracle 版本是 10.2.0.5.
My Oracle version is 10.2.0.5.
-- Oracle 10g --
-- Oracle 10g --
SELECT deptno, WM_CONCAT(ename) AS employees
FROM scott.emp
GROUP BY deptno;
Output:
10 CLARK,MILLER,KING
20 SMITH,FORD,ADAMS,SCOTT,JONES
30 ALLEN,JAMES,TURNER,BLAKE,MARTIN,WARD
这篇关于在 Oracle 中连接 SQL 查询的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!