有一张表 user
列如下:
cool1 cool2
林 A
陈 B
张 F
陈 C
张 D
张 E
林 D
---------------------------------
如何实现查询结果
cool1 cool2
林 AD
陈 BC
张 DEF
------------------------------------
多谢各位!!
列如下:
cool1 cool2
林 A
陈 B
张 F
陈 C
张 D
张 E
林 D
---------------------------------
如何实现查询结果
cool1 cool2
林 AD
陈 BC
张 DEF
------------------------------------
多谢各位!!
解决方案 »
- 创建了oracle 函数,但是在 plsql的function中找不到,数据库中也没有这函数。
- 在oracle中求一trigger
- oracle连上网线无法启动,若已启动连上网线则无法停止。
- 求教一个简单的问题
- oracle触发器
- 小弟才学oracle9i,希望大哥大姐们帮帮我!
- 知道的请支持——在SQL*PLUS界面中怎样导出存储过程?
- 请教一个关于IN的sql语句
- 100分求助!不使用游标,在Oracle的过程中如何才能返回多条记录!????
- 急!!在线等!!oracle 存储过程加入对工资求最大值,最小值,平均值,总值
- 怎麼把兩條sql查詢結果串接在一起
- 新服务器及存储设备如何使用原ORACLE数据库?
--10g以上用wm_concat函数
select cool1,replace(wm_concat(cool2),',','') cool2
from user
group by cool1
/
SQL> with t as(
2 select '林' cool1,'A' cool2 from dual union all
3 select '陈','B' from dual union all
4 select '张','F' from dual union all
5 select '陈','C' from dual union all
6 select '张','D' from dual union all
7 select '张','E' from dual union all
8 select '林','D' from dual)
9 select cool1,replace(wm_concat(cool2),',','') cool2
10 from t
11 group by cool1
12 /
COOL1 COOL2
----- ---------------------------
陈 BC
林 AD
张 FDE
from user
group by cool1wm_concat在10g版本以上可以用。