有一个表结构如下
col1 col2 col3
--------------
a b c
a b d
e f g
e f h想求一条sql
搜索之后的结果为
col1 col2 col3
--------------
a b c,d
e f g,h十分感谢~
col1 col2 col3
--------------
a b c
a b d
e f g
e f h想求一条sql
搜索之后的结果为
col1 col2 col3
--------------
a b c,d
e f g,h十分感谢~
解决方案 »
- 高难度select语句的编写
- 删除表A和表B中相同的数据,删除的是那个表中的数据?
- oracle 管理客户端和服务器连接问题
- 请高手解答:在ORACLE中,联合查询表,假如有一个表不存在,ORACLE可否知道那个表不存在?
- ****请教如何将存储过程返回的记录集写入文本文件****
- oracle10g连接oracle9i
- 在线求救
- 如何实现SQL Server数据库中的某张表,定时导入Oracle数据库中?
- 关于Linux系统下Oracle 11.2.0.3 打 11.2.0.3.5 PSU error code 73
- Java链接Oracle抛异常,但是用PLSQL能连上
- plsql 一个包的用法
- 求一条oracle语句 查询昨天的数据
(
select 'a' a, 'b' b, 'c' c from dual
union all
select 'a' a, 'b' b, 'd' c from dual
union all
select 'e' a, 'f' b, 'g' c from dual
union all
select 'e' a, 'f' b, 'h' c from dual
)
select a,b,max(substr(sys_connect_by_path(c,','),2))
from
( select a,b,c,row_number() over(partition by a,b order by a) rn from t)
start with rn=1 connect by rn-1=prior rn and a=prior a
group by a,b
order by a,b
--result:a b c,d
e f g,h
with t as
(
select 'a' a, 'b' b, 'c' c from dual
union all
select 'a' a, 'b' b, 'd' c from dual
union all
select 'e' a, 'f' b, 'g' c from dual
union all
select 'e' a, 'f' b, 'h' c from dual
)
select a,b,wm_concat(c)
from t
group by a,b;