问题是这样的,需要把B表中每个MAIN_NUM对应的的ATTACH_NAME拼在一起取出来,而且只能是一个sql查询语句,因为这个sql作为水晶报表中的数据源所以不能写成一个方法,所以比较头痛请各位支招。
4 个解决方案
#1
11g的listagg
#2
非常感谢,不过不知道水晶报表中是否支持此方法,我记得水晶报表中好像只支持标准sql,周一试试看吧,多谢大大
#3
select a.id , wmsys.wm_concat(b.attach_name)
from a,
b where a.main_unm = b.main_num
group by a.id
from a,
b where a.main_unm = b.main_num
group by a.id
#4
略改楼上sql,他的是inner,这提供left join
select a.id,wmsys.wm_concat(b.attach_name) attach_name
from a
left join b on b.main_num = a.main_num
group by a.id
#1
11g的listagg
#2
非常感谢,不过不知道水晶报表中是否支持此方法,我记得水晶报表中好像只支持标准sql,周一试试看吧,多谢大大
#3
select a.id , wmsys.wm_concat(b.attach_name)
from a,
b where a.main_unm = b.main_num
group by a.id
from a,
b where a.main_unm = b.main_num
group by a.id
#4
略改楼上sql,他的是inner,这提供left join
select a.id,wmsys.wm_concat(b.attach_name) attach_name
from a
left join b on b.main_num = a.main_num
group by a.id